File Coverage

lib/Date/Holidays/Adapter/NL.pm
Criterion Covered Total %
statement 21 30 70.0
branch 1 4 25.0
condition n/a
subroutine 5 6 83.3
pod 2 2 100.0
total 29 42 69.0


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