I had an email recently regarding Calendar::List. It suggested adding some support for holidays. I hadn't thought about that before, but it seems a good idea. I was thinking about the best way to add this support. The nice way would be to enable support for the Holiday::* modules, which would help to improve those authors Kwalitee rating. However, as Richard Clamp points out, not all APIs are consistent. Also what if there isn't a holiday module for a particular country, or a user wants to be able past a standard list to the module. So to keep things simple I've added the 'holidays => \@holidays' option to the configuration hash.
my @holidays = are_holidays(2005); my %hash = { exclude => { 'holidays' = \@holidays } }; my @list = calendar_list('DD-MM-YYYY', \%hash);
The only awkward bit is the are_holidays() function, which would the rely on being able to generate the holiday dates in the format required for calendar_list(). But then with an example patch to Date::Holidays::UK, you could do the following:
use Date::Holidays::UK;
sub are_holidays { my $year = shift; my @dates; for my $date (are_uk_holidays($year)) { my @elms = split(/-/,$date); push @dates sprintf "%02d-%02d-%04d", $elms[2], $elms[1], $elms[0]; }
return @dates; }
In the meantime Calendar-List-0.17.tar.gz is now on its way to CPAN :)