Subject: | Patch for simple improvement |
Hello,
I experienced a problem with your module Date::Holidays::AU in conjunction with Date::Holidays - so I have made this small patch, which enables the default state also for the is_holiday sub.
The value has been moved to a constant, so it is only is defined in one place.
I am planning to give the Date::Holidays concept an overhaul, I might get back to you later on.
Thanks for contributing to the namespace BTW
jonasbn
Index: AU.pm
===================================================================
RCS file: /cvs/patches/Date-Holidays-0.02/lib/Date/Holidays/AU.pm,v
retrieving revision 1.1
diff -u -r1.1 AU.pm
--- AU.pm 9 Dec 2005 22:20:20 -0000 1.1
+++ AU.pm 9 Dec 2005 22:21:18 -0000
@@ -13,6 +13,8 @@
our (%cached);
+use constant DEFAULT_STATE => 'VIC';
+
sub holidays {
my (%params) = @_;
unless (exists $params{year}) {
@@ -26,7 +28,7 @@
}
my ($year) = $params{year};
unless (exists $params{state}) {
- $params{state} = 'VIC';
+ $params{state} = DEFAULT_STATE;
}
unless (defined $params{state}) {
die("State is undefined\n");
@@ -313,7 +315,7 @@
sub is_holiday {
my ($year, $month, $day, $state, $params) = @_;
my ($key);
- my ($concat) = $state;
+ my ($concat) = $state ||= DEFAULT_STATE;
foreach $key (%$params) {
next unless ($params->{$key});
if (ref $params->{$key}) {