File Coverage

lib/Date/Holidays/Adapter/UA.pm
Criterion Covered Total %
statement 20 27 74.0
branch 1 4 25.0
condition n/a
subroutine 6 7 85.7
pod 2 2 100.0
total 29 40 72.5


line stmt bran cond sub pod time code
1              
2             use strict;
3 1     1   538 use warnings;
  1         2  
  1         29  
4 1     1   5 use vars qw($VERSION);
  1         1  
  1         28  
5 1     1   5 use Carp;
  1         2  
  1         37  
6 1     1   5  
  1         2  
  1         66  
7             use base 'Date::Holidays::Adapter';
8 1     1   6  
  1         2  
  1         254  
9             $VERSION = '1.33';
10              
11             my ($self, %params) = @_;
12              
13 0     0 1 0 my $sub = $self->{_adaptee}->can('holidays');
14              
15 0         0 if ($sub) {
16             return &{$sub}($params{'year'});
17 0 0       0 } else {
18 0         0 return {};
  0         0  
19             }
20 0         0 }
21              
22             my ($self, %params) = @_;
23              
24             my $sub = $self->{_adaptee}->can('is_holiday');
25 1     1 1 3  
26             if ($sub) {
27 1         5 return &{$sub}($params{'year'}, $params{'month'}, $params{'day'});
28             } else {
29 1 50       3 return;
30 1         2 }
  1         3  
31             }
32 0            
33             1;
34              
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             Date::Holidays::Adapter::UA - an adapter class for Date::Holidays::UA
43              
44             =head1 VERSION
45              
46             This POD describes version 1.33 of Date::Holidays::Adapter::UA
47              
48             =head1 DESCRIPTION
49              
50             The is the adapter class for L<Date::Holidays::UA>.
51              
52             =head1 SUBROUTINES/METHODS
53              
54             =head2 new
55              
56             The constructor, takes a single named argument, B<countrycode>
57              
58             =head2 is_holiday
59              
60             The B<holidays> method, takes 3 named arguments, B<year>, B<month> and B<day>
61              
62             Returns an indication of whether the day is a holiday in the calendar of the
63             country referenced by B<countrycode> in the call to the constructor B<new>.
64              
65             =head2 holidays
66              
67             The B<holidays> method, takes a single named argument, B<year>
68              
69             Returns a reference to a hash holding the calendar of the country referenced by
70             B<countrycode> in the call to the constructor B<new>.
71              
72             The calendar will spand for a year and the keys consist of B<month> and B<day>
73             concatenated.
74              
75             =head1 DIAGNOSTICS
76              
77             Please refer to DIAGNOSTICS in L<Date::Holidays>
78              
79             =head1 DEPENDENCIES
80              
81             =over
82              
83             =item * L<Date::Holidays::UA>
84              
85             =item * L<Date::Holidays::Adapter>
86              
87             =back
88              
89             =head1 INCOMPATIBILITIES
90              
91             Please refer to INCOMPATIBILITIES in L<Date::Holidays>
92              
93             =head1 BUGS AND LIMITATIONS
94              
95             The adapter does not implement the B<is_holiday> or B<holidays> methods.
96              
97             =head1 BUG REPORTING
98              
99             Please refer to BUG REPORTING in L<Date::Holidays>
100              
101             =head1 AUTHOR
102              
103             Denis Boyun, C<< <denisboyun at gmail.com> >>
104             Jonas Brømsø, (jonasbn) - C<< <jonasbn@cpan.org> >>
105              
106             =head1 LICENSE AND COPYRIGHT
107              
108             L<Date::Holidays> and related modules are (C) by Jonas Brømsø, (jonasbn)
109             2004-2022
110              
111             Date-Holidays and related modules are released under the Artistic License 2.0
112              
113             =cut