File Coverage

lib/Date/Holidays/Adapter/NZ.pm
Criterion Covered Total %
statement 16 28 57.1
branch 2 8 25.0
condition 1 6 16.6
subroutine 5 6 83.3
pod 2 2 100.0
total 26 50 52.0


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