line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Holidays::USFederal; |
2
|
1
|
|
|
1
|
|
1000
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
4
|
1
|
|
|
1
|
|
17
|
use base qw(Exporter); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1412
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
our @EXPORT = qw( is_usfed_holiday ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Date::Holidays::USFederal - Determine US Federal Public Holidays |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Date::Holidays::USFederal; |
15
|
|
|
|
|
|
|
my ($year, $month, $day) = (localtime)[ 5, 4, 3 ]; |
16
|
|
|
|
|
|
|
$year += 1900; |
17
|
|
|
|
|
|
|
$month += 1; |
18
|
|
|
|
|
|
|
print "Woohoo" if is_usfed_holiday( $year, $month, $day ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
The naming convention for the module follows that of L(Date::Holidays:UK) |
23
|
|
|
|
|
|
|
as where the format for this module was also taken. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SUBROUTINES |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 is_usfed_holiday( $year, $month, $day ) |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Returns the name of the Holiday that falls on the given day, or undef |
30
|
|
|
|
|
|
|
if there is none. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
our %holidays; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$holidays{ 1997, 1, 1 } = |
39
|
|
|
|
|
|
|
$holidays{ 1998, 1, 1 } = |
40
|
|
|
|
|
|
|
$holidays{ 1999, 1, 1 } = |
41
|
|
|
|
|
|
|
$holidays{ 1999, 12, 31 } = |
42
|
|
|
|
|
|
|
$holidays{ 2001, 1, 1 } = |
43
|
|
|
|
|
|
|
$holidays{ 2002, 1, 1 } = |
44
|
|
|
|
|
|
|
$holidays{ 2003, 1, 1 } = |
45
|
|
|
|
|
|
|
$holidays{ 2004, 1, 1 } = |
46
|
|
|
|
|
|
|
$holidays{ 2004, 12, 31 } = |
47
|
|
|
|
|
|
|
$holidays{ 2006, 1, 2 } = |
48
|
|
|
|
|
|
|
$holidays{ 2007, 1, 1 } = |
49
|
|
|
|
|
|
|
$holidays{ 2008, 1, 1 } = |
50
|
|
|
|
|
|
|
$holidays{ 2009, 1, 1 } = |
51
|
|
|
|
|
|
|
$holidays{ 2010, 1, 1 } = "New Year's Day"; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$holidays{ 1997, 1, 20 } = |
54
|
|
|
|
|
|
|
$holidays{ 1998, 1, 19 } = |
55
|
|
|
|
|
|
|
$holidays{ 1999, 1, 18 } = |
56
|
|
|
|
|
|
|
$holidays{ 2000, 1, 17 } = |
57
|
|
|
|
|
|
|
$holidays{ 2001, 1, 15 } = |
58
|
|
|
|
|
|
|
$holidays{ 2002, 1, 17 } = |
59
|
|
|
|
|
|
|
$holidays{ 2003, 1, 20 } = |
60
|
|
|
|
|
|
|
$holidays{ 2004, 1, 19 } = |
61
|
|
|
|
|
|
|
$holidays{ 2005, 1, 17 } = |
62
|
|
|
|
|
|
|
$holidays{ 2006, 1, 16 } = |
63
|
|
|
|
|
|
|
$holidays{ 2007, 1, 15 } = |
64
|
|
|
|
|
|
|
$holidays{ 2008, 1, 21 } = |
65
|
|
|
|
|
|
|
$holidays{ 2009, 1, 19 } = |
66
|
|
|
|
|
|
|
$holidays{ 2010, 1, 18 } = "Martin Luther King, Jr. Birthday"; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$holidays{ 1997, 2, 17 } = |
69
|
|
|
|
|
|
|
$holidays{ 1998, 2, 16 } = |
70
|
|
|
|
|
|
|
$holidays{ 1999, 2, 15 } = |
71
|
|
|
|
|
|
|
$holidays{ 2000, 2, 21 } = |
72
|
|
|
|
|
|
|
$holidays{ 2001, 2, 19 } = |
73
|
|
|
|
|
|
|
$holidays{ 2002, 2, 18 } = |
74
|
|
|
|
|
|
|
$holidays{ 2003, 2, 17 } = |
75
|
|
|
|
|
|
|
$holidays{ 2004, 2, 16 } = |
76
|
|
|
|
|
|
|
$holidays{ 2005, 2, 21 } = |
77
|
|
|
|
|
|
|
$holidays{ 2006, 2, 20 } = |
78
|
|
|
|
|
|
|
$holidays{ 2007, 2, 19 } = |
79
|
|
|
|
|
|
|
$holidays{ 2008, 2, 18 } = |
80
|
|
|
|
|
|
|
$holidays{ 2009, 2, 16 } = |
81
|
|
|
|
|
|
|
$holidays{ 2010, 2, 15 } ="Washington's Birthday / Presidents Day"; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$holidays{ 1997, 5, 26 } = |
84
|
|
|
|
|
|
|
$holidays{ 1998, 5, 25 } = |
85
|
|
|
|
|
|
|
$holidays{ 1999, 5, 31 } = |
86
|
|
|
|
|
|
|
$holidays{ 2000, 5, 29 } = |
87
|
|
|
|
|
|
|
$holidays{ 2001, 5, 28 } = |
88
|
|
|
|
|
|
|
$holidays{ 2002, 5, 27 } = |
89
|
|
|
|
|
|
|
$holidays{ 2003, 5, 26 } = |
90
|
|
|
|
|
|
|
$holidays{ 2004, 5, 31 } = |
91
|
|
|
|
|
|
|
$holidays{ 2005, 5, 28 } = |
92
|
|
|
|
|
|
|
$holidays{ 2006, 5, 29 } = |
93
|
|
|
|
|
|
|
$holidays{ 2007, 5, 28 } = |
94
|
|
|
|
|
|
|
$holidays{ 2008, 5, 26 } = |
95
|
|
|
|
|
|
|
$holidays{ 2009, 5, 25 } = |
96
|
|
|
|
|
|
|
$holidays{ 2010, 5, 31 } = "Memorial Day"; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$holidays{ 1997, 7, 4 } = |
99
|
|
|
|
|
|
|
$holidays{ 1998, 7, 5 } = |
100
|
|
|
|
|
|
|
$holidays{ 1999, 7, 4 } = |
101
|
|
|
|
|
|
|
$holidays{ 2000, 7, 4 } = |
102
|
|
|
|
|
|
|
$holidays{ 2001, 7, 4 } = |
103
|
|
|
|
|
|
|
$holidays{ 2002, 7, 4 } = |
104
|
|
|
|
|
|
|
$holidays{ 2003, 7, 4 } = |
105
|
|
|
|
|
|
|
$holidays{ 2004, 7, 5 } = |
106
|
|
|
|
|
|
|
$holidays{ 2005, 7, 4 } = |
107
|
|
|
|
|
|
|
$holidays{ 2006, 7, 4 } = |
108
|
|
|
|
|
|
|
$holidays{ 2007, 7, 4 } = |
109
|
|
|
|
|
|
|
$holidays{ 2008, 7, 4 } = |
110
|
|
|
|
|
|
|
$holidays{ 2009, 7, 3 } = |
111
|
|
|
|
|
|
|
$holidays{ 2010, 7, 5 } = "Independence Day"; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
$holidays{ 1997, 9, 1 } = |
114
|
|
|
|
|
|
|
$holidays{ 1998, 9, 1 } = |
115
|
|
|
|
|
|
|
$holidays{ 1999, 9, 6 } = |
116
|
|
|
|
|
|
|
$holidays{ 2000, 9, 4 } = |
117
|
|
|
|
|
|
|
$holidays{ 2001, 9, 3 } = |
118
|
|
|
|
|
|
|
$holidays{ 2002, 9, 2 } = |
119
|
|
|
|
|
|
|
$holidays{ 2003, 9, 1 } = |
120
|
|
|
|
|
|
|
$holidays{ 2004, 9, 6 } = |
121
|
|
|
|
|
|
|
$holidays{ 2005, 9, 5 } = |
122
|
|
|
|
|
|
|
$holidays{ 2006, 9, 4 } = |
123
|
|
|
|
|
|
|
$holidays{ 2007, 9, 3 } = |
124
|
|
|
|
|
|
|
$holidays{ 2008, 9, 1 } = |
125
|
|
|
|
|
|
|
$holidays{ 2009, 9, 7 } = |
126
|
|
|
|
|
|
|
$holidays{ 2010, 9, 6 } = "Labor Day"; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
$holidays{ 1997, 10, 13 } = |
129
|
|
|
|
|
|
|
$holidays{ 1998, 10, 13 } = |
130
|
|
|
|
|
|
|
$holidays{ 1999, 10, 11 } = |
131
|
|
|
|
|
|
|
$holidays{ 2000, 10, 9 } = |
132
|
|
|
|
|
|
|
$holidays{ 2001, 10, 8 } = |
133
|
|
|
|
|
|
|
$holidays{ 2002, 10, 14 } = |
134
|
|
|
|
|
|
|
$holidays{ 2003, 10, 13 } = |
135
|
|
|
|
|
|
|
$holidays{ 2004, 10, 11 } = |
136
|
|
|
|
|
|
|
$holidays{ 2005, 10, 10 } = |
137
|
|
|
|
|
|
|
$holidays{ 2006, 10, 9 } = |
138
|
|
|
|
|
|
|
$holidays{ 2007, 10, 8 } = |
139
|
|
|
|
|
|
|
$holidays{ 2008, 10, 13 } = |
140
|
|
|
|
|
|
|
$holidays{ 2009, 10, 12 } = |
141
|
|
|
|
|
|
|
$holidays{ 2010, 10, 11 } = "Columbus Day"; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
$holidays{ 1997, 11, 11 } = |
144
|
|
|
|
|
|
|
$holidays{ 1998, 11, 11 } = |
145
|
|
|
|
|
|
|
$holidays{ 1999, 11, 11 } = |
146
|
|
|
|
|
|
|
$holidays{ 2000, 11, 10 } = |
147
|
|
|
|
|
|
|
$holidays{ 2001, 11, 12 } = |
148
|
|
|
|
|
|
|
$holidays{ 2002, 11, 11 } = |
149
|
|
|
|
|
|
|
$holidays{ 2003, 11, 11 } = |
150
|
|
|
|
|
|
|
$holidays{ 2004, 11, 11 } = |
151
|
|
|
|
|
|
|
$holidays{ 2005, 11, 11 } = |
152
|
|
|
|
|
|
|
$holidays{ 2006, 11, 10 } = |
153
|
|
|
|
|
|
|
$holidays{ 2007, 11, 12 } = |
154
|
|
|
|
|
|
|
$holidays{ 2008, 11, 11 } = |
155
|
|
|
|
|
|
|
$holidays{ 2009, 11, 11 } = |
156
|
|
|
|
|
|
|
$holidays{ 2010, 11, 11 } = "Veterans Day"; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
$holidays{ 1997, 11, 27 } = |
159
|
|
|
|
|
|
|
$holidays{ 1998, 11, 27 } = |
160
|
|
|
|
|
|
|
$holidays{ 1999, 11, 25 } = |
161
|
|
|
|
|
|
|
$holidays{ 2000, 11, 23 } = |
162
|
|
|
|
|
|
|
$holidays{ 2001, 11, 22 } = |
163
|
|
|
|
|
|
|
$holidays{ 2002, 11, 28 } = |
164
|
|
|
|
|
|
|
$holidays{ 2003, 11, 27 } = |
165
|
|
|
|
|
|
|
$holidays{ 2004, 11, 25 } = |
166
|
|
|
|
|
|
|
$holidays{ 2005, 11, 24 } = |
167
|
|
|
|
|
|
|
$holidays{ 2006, 11, 23 } = |
168
|
|
|
|
|
|
|
$holidays{ 2007, 11, 22 } = |
169
|
|
|
|
|
|
|
$holidays{ 2008, 11, 27 } = |
170
|
|
|
|
|
|
|
$holidays{ 2009, 11, 26 } = |
171
|
|
|
|
|
|
|
$holidays{ 2010, 11, 25 } = "Thanksgiving Day"; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
$holidays{ 1997, 12, 25 } = |
174
|
|
|
|
|
|
|
$holidays{ 1998, 12, 25 } = |
175
|
|
|
|
|
|
|
$holidays{ 1999, 12, 24 } = |
176
|
|
|
|
|
|
|
$holidays{ 2000, 12, 25 } = |
177
|
|
|
|
|
|
|
$holidays{ 2001, 12, 25 } = |
178
|
|
|
|
|
|
|
$holidays{ 2002, 12, 25 } = |
179
|
|
|
|
|
|
|
$holidays{ 2003, 12, 25 } = |
180
|
|
|
|
|
|
|
$holidays{ 2004, 12, 24 } = |
181
|
|
|
|
|
|
|
$holidays{ 2005, 12, 26 } = |
182
|
|
|
|
|
|
|
$holidays{ 2006, 12, 25 } = |
183
|
|
|
|
|
|
|
$holidays{ 2007, 12, 25 } = |
184
|
|
|
|
|
|
|
$holidays{ 2008, 12, 25 } = |
185
|
|
|
|
|
|
|
$holidays{ 2009, 12, 25 } = |
186
|
|
|
|
|
|
|
$holidays{ 2010, 12, 24 } = "Christmas Day"; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub is_usfed_holiday { |
190
|
2
|
|
|
2
|
1
|
864
|
my ($year, $month, $day) = @_; |
191
|
2
|
|
|
|
|
649
|
return $holidays{ $year, $month, $day }; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
1; |
195
|
|
|
|
|
|
|
__END__ |