line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Holidays::ES; |
2
|
2
|
|
|
2
|
|
3537
|
use base 'Date::Holidays::Super'; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
1854
|
|
3
|
2
|
|
|
2
|
|
525
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
18
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
55
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1763
|
use Date::Easter (); |
|
2
|
|
|
|
|
6702
|
|
|
2
|
|
|
|
|
38
|
|
7
|
2
|
|
|
2
|
|
1898
|
use Time::JulianDay (); |
|
2
|
|
|
|
|
9571
|
|
|
2
|
|
|
|
|
57
|
|
8
|
2
|
|
|
2
|
|
46
|
use Carp qw(croak); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1082
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
4
|
|
|
4
|
1
|
2458
|
my $class = shift; |
15
|
4
|
|
|
|
|
19
|
return bless \$class, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub is_holiday { |
19
|
6
|
|
|
6
|
1
|
44
|
my ($self, %params) = @_; |
20
|
6
|
50
|
|
|
|
20
|
my $year = $params{'year'} or croak 'Missing year argument'; |
21
|
6
|
50
|
|
|
|
18
|
my $month = $params{'month'} or croak 'Missing month argument'; |
22
|
6
|
50
|
|
|
|
17
|
my $day = $params{'day'} or croak 'Missing day argument'; |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
17
|
my $holidays = $self->holidays(year => $year); |
25
|
|
|
|
|
|
|
|
26
|
6
|
|
|
|
|
15
|
my $month_day = sprintf "%02d%02d", $month, $day; |
27
|
|
|
|
|
|
|
|
28
|
6
|
50
|
|
|
|
17
|
if (exists $holidays->{$month_day}) { |
29
|
6
|
|
|
|
|
58
|
return $holidays->{$month_day}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub is_es_holiday { |
36
|
3
|
|
|
3
|
1
|
544
|
my $self = shift; |
37
|
3
|
|
|
|
|
8
|
return $self->is_holiday(@_); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub holidays { |
41
|
8
|
|
|
8
|
1
|
19
|
my ($self, %params) = @_; |
42
|
8
|
50
|
|
|
|
53
|
my $year = $params{'year'} or croak 'Missing year argument'; |
43
|
|
|
|
|
|
|
|
44
|
8
|
|
|
|
|
46
|
my $holidays = { |
45
|
|
|
|
|
|
|
'0101' => 'Año Nuevo', |
46
|
|
|
|
|
|
|
#'0106' => 'Día de Reyes', |
47
|
|
|
|
|
|
|
'0501' => 'Día del Trabajo', |
48
|
|
|
|
|
|
|
'1012' => 'Día de la Hispanidad', |
49
|
|
|
|
|
|
|
'1101' => 'Día de Todos los Santos', |
50
|
|
|
|
|
|
|
'1206' => 'Día de la Constitución', |
51
|
|
|
|
|
|
|
'1208' => 'Día de la Inmaculada Concepción', |
52
|
|
|
|
|
|
|
'1225' => 'Navidad', |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
|
55
|
8
|
|
|
|
|
27
|
my ($emonth, $eday) = Date::Easter::gregorian_easter($year); |
56
|
8
|
|
|
|
|
141
|
my $jd = Time::JulianDay::julian_day($year, $emonth, $eday); |
57
|
|
|
|
|
|
|
|
58
|
8
|
|
|
|
|
69
|
my (undef, $smonth, $sday) = Time::JulianDay::inverse_julian_day($jd - 2); |
59
|
8
|
|
|
|
|
131
|
my $month_day = sprintf "%02d%02d", $smonth, $sday; |
60
|
8
|
|
|
|
|
30
|
$holidays->{$month_day} = 'Viernes Santo'; |
61
|
|
|
|
|
|
|
|
62
|
8
|
|
|
|
|
23
|
return $holidays; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub es_holidays { |
66
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
67
|
1
|
|
|
|
|
4
|
return $self->holidays(@_); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub holidays_es { |
71
|
1
|
|
|
1
|
1
|
637
|
my ($self, %params) = @_; |
72
|
1
|
50
|
|
|
|
6
|
my $year = $params{'year'} or croak 'Missing year argument'; |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
4
|
my $holidays = $self->holidays(year => $year); |
75
|
1
|
|
|
|
|
3
|
my %hd = (); |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
10
|
require DateTime; |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
6
|
for my $month_day (keys %$holidays) { |
80
|
8
|
|
|
|
|
1476
|
my ($month, $day) = unpack "A2A2", $month_day; |
81
|
8
|
|
|
|
|
37
|
$hd{ $holidays->{$month_day} } = DateTime->new( |
82
|
|
|
|
|
|
|
year => $year, |
83
|
|
|
|
|
|
|
month => $month, |
84
|
|
|
|
|
|
|
day => $day, |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
194
|
return \%hd; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |