File Coverage

blib/lib/Date/Holidays/Adapter/USExtended.pm
Criterion Covered Total %
statement 17 19 89.4
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 26 30 86.6


line stmt bran cond sub pod time code
1             package Date::Holidays::Adapter::USExtended;
2             our $AUTHORITY = 'cpan:GENE';
3              
4             # ABSTRACT: Adapter for the USExtended module holidays
5              
6 2     2   1344588 use strict;
  2         5  
  2         76  
7 2     2   9 use warnings;
  2         5  
  2         120  
8              
9 2     2   12 use base qw(Date::Holidays::Adapter);
  2         4  
  2         1199  
10              
11             our $VERSION = '0.0201';
12              
13              
14              
15             sub holidays {
16 1     1 1 7040 my ($self, %params) = @_;
17              
18 1         6 my $dh = $self->{_adaptee}->new;
19              
20 1 50       6 if ($dh) {
21 1         4 return $dh->holidays($params{year});
22             } else {
23 0         0 return;
24             }
25             }
26              
27              
28             sub is_holiday {
29 1     1 1 4533 my ($self, %params) = @_;
30              
31 1         6 my $dh = $self->{_adaptee}->new;
32              
33 1 50       9 if ($dh) {
34 1         3 return $dh->is_holiday($params{year}, $params{month}, $params{day});
35             } else {
36 0           return '';
37             }
38             }
39              
40             1;
41              
42             __END__
43              
44             =pod
45              
46             =encoding UTF-8
47              
48             =head1 NAME
49              
50             Date::Holidays::Adapter::USExtended - Adapter for the USExtended module holidays
51              
52             =head1 VERSION
53              
54             version 0.0201
55              
56             =head1 DESCRIPTION
57              
58             C<Date::Holidays::Adapter::USExtended> is the L<Date::Holidays> adapter for L<Date::Holidays::USExtended>.
59              
60             =head1 FUNCTIONS
61              
62             =head2 holidays
63              
64             $holidays = holidays($year);
65              
66             Return the known holidays for the given year.
67              
68             =head2 is_holiday
69              
70             $holiday = is_holiday($year, $month, $day);
71              
72             Return the holiday on the given day.
73              
74             =head1 SEE ALSO
75              
76             L<Date::Holidays>
77              
78             L<Date::Holidays::Adapter>
79              
80             L<Date::Holidays::USA>
81              
82             =head1 AUTHOR
83              
84             Gene Boggs <gene@cpan.org>
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is Copyright (c) 2024 by Gene Boggs.
89              
90             This is free software, licensed under:
91              
92             The Artistic License 2.0 (GPL Compatible)
93              
94             =cut