File Coverage

lib/Date/Holidays/Adapter/AU.pm
Criterion Covered Total %
statement 21 29 72.4
branch 2 8 25.0
condition n/a
subroutine 6 7 85.7
pod 2 2 100.0
total 31 46 67.3


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