File Coverage

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