blib/lib/LT.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 51 MC/DCmcdc 0.0% 0 / 32 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 161 CC 16 SCAR 53.4
CC
16
Cov
0%
is_lt_holiday
272.0
BEGIN
2.0
BEGIN
2.0
CRAP 207.7
1 package Date::Holidays::LT;
2  
3 use strict;
4 use warnings;
5 use POSIX qw(strftime);
6 use Date::Easter;
7 use Exporter;
8 our @ISA = qw(Exporter);
9 our @EXPORT = qw(is_lt_holiday);
10  
11 our $VERSION = '0.01';
12  
13 sub is_lt_holiday {
14 my ($year, $month, $day) = @_;
15  
16 if ($day == 1 and $month == 1) { return "New Year's Day"; }
17 elsif ($day == 16 and $month == 2) { return "Day of Re-establishment of the State of Lithuania"; }
18 elsif ($day == 11 and $month == 3) { return "Day of Restitution of Independence of Lithuania"; }
19 elsif ($day == 1 and $month == 5) { return "International Labor Day"; }
20 elsif ($day == 24 and $month == 6) { return "Day of Dew"; } # "Rasos", "Joninės"
21 # "Lietuvos karaliaus Mindaugo karūnavimo diena":
22 elsif ($day == 6 and $month == 7) { return "Statehood Day"; }
23 elsif ($day == 15 and $month == 8) { return "Herbal Day"; } # "Žolinės"
24 elsif ($day == 1 and $month == 11) { return "All Saints' Day"; } # "Visų šventųjų diena"
25 elsif ($day == 24 and $month == 12) { return "Christmas eve"; }
26 elsif ($day == 25 and $month == 12) { return "Christmas"; }
27 elsif ($day == 26 and $month == 12) { return "Christmas"; }
28 else {
29 my ($easter_month, $easter_day) = Date::Easter::easter($year);
30 my $wday = strftime("%w", 0, 0, 0, $day, $month-1, $year-1900);
31  
32 if ($day == $easter_day and $month == $easter_month) {
33 return "Easter";
34 }
35 elsif ($day == ($easter_day + 1) and $month == $easter_month) {
36 return "Easter";
37 }
38  
39 if ($wday == 0 and $day <= 7 and $month == 5) {
40 return "Mother's day"; # first sunday of May
41 }
42 if ($wday == 0 and $day <= 7 and $month == 6) {
43 return "Father's day"; # first sunday of June
44 }
45 }
46 }
47  
48 1;
49  
50 __END__