File Coverage

blib/lib/Date/Holidays/Adapter/NZ.pm
Criterion Covered Total %
statement 12 28 42.8
branch 0 8 0.0
condition 0 6 0.0
subroutine 4 6 66.6
pod 2 2 100.0
total 18 50 36.0


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