NAME

Date::Holidays::Adapter::Local - a specialized adapter for local calendars

VERSION

This POD describes version 1.35 of Date::Holidays::Adapter::Local

SYNOPSIS

my $calendar = Date::Holidays->new(countrycode => 'local');

my ($year, $month, $day) = (localtime)[ 5, 4, 3 ];
$year  += 1900;
$month += 1;

print "Woohoo" if $calendar->is_holiday(
    year  => $year,
    month => $month,
    day   => $day
);

my $holidays = $adapter->holidays(year => $year);

printf "Jan. 15th is named '%s'\n", $holidays->{'0115'}; #my birthday I hope

DESCRIPTION

The is the SUPER adapter class. All of the adapters in the distribution of Date::Holidays are subclasses of this class. (SEE also Date::Holidays).

The SUPER adapter class is at the same time a generic adapter. It attempts to adapt to the most used API for modules in the Date::Holidays::* namespace. So it should only be necessary to implement adapters to the exceptions to modules not following the the defacto standard or suffering from other local implementations.

SUBROUTINES/METHODS

The public methods in this class are all expected from the adapter, so it actually corresponds with the abstract is outlined in Date::Holidays::Abstract.

Not all methods/subroutines may be implemented in the adaptee classes, the adapters attempt to make the adaptee APIs adaptable where possible. This is afterall the whole idea of the Adapter Pattern, but apart from making the single Date::Holidays::* modules uniform towards the clients and Date::Holidays it is attempted to make the multitude of modules uniform in the extent possible.

new

The constructor, takes a single named argument, countrycode

is_holiday

The holidays method, takes 3 named arguments, year, month and day

returns an indication of whether the day is a holiday in the calendar of the country referenced by countrycode in the call to the constructor new.

holidays

The holidays method, takes a single named argument, year

returns a reference to a hash holding the calendar of the country referenced by countrycode in the call to the constructor new.

The calendar will spand for a year and the keys consist of month and day concatenated.

DEFINING A LOCAL CALENDAR

Please refer to the DEVELOPER section in Date::Holidays about contributing to the Date::Holidays::* namespace or attempting for adaptability with Date::Holidays.

DIAGNOSTICS

Please refer to DIAGNOSTICS in Date::Holidays

DEPENDENCIES

Please see the cpanfile included in the distribution for a complete listing.

INCOMPATIBILITIES

Please refer to INCOMPATIBILITIES in Date::Holidays

BUGS AND LIMITATIONS

Please refer to BUGS AND LIMITATIONS in Date::Holidays

BUG REPORTING

Please refer to BUG REPORTING in Date::Holidays

AUTHOR

Jonas Brømsø, (jonasbn) - <jonasbn@cpan.org>

LICENSE AND COPYRIGHT

Date::Holidays and related modules are (C) by Jonas Brømsø, (jonasbn) 2004-2022

Date::Holidays and related modules are released under the Artistic License 2.0