File Coverage

blib/lib/Date/Holidays/Adapter/PT.pm
Criterion Covered Total %
statement 12 22 54.5
branch 0 4 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 18 34 52.9


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