Skip Menu |

This queue is for tickets about the Date-Holidays-AU CPAN distribution.

Report information
The Basics
Id: 16411
Status: resolved
Worked: 5 min
Priority: 0/
Queue: Date-Holidays-AU

People
Owner: Nobody in particular
Requestors: jonasbn [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.02
Fixed in: (no value)



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}) {
Applied in Date::Holidays::AU VERSION 0.03. Thanks Jonas.