The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Date::HolidayParser::iCalendar - iCalendar-like interface extension to Date::HolidayParser

VERSION

0.4

SYNOPSIS

This is an extension to Date::HolidayParser that adds an iCalendar-like interface to the holiday data.

        use Date::HolidayParser;

        my $Holidays = Date::HolidayParser->new("$ENV{HOME}/.holiday");
        
        ...

DESCRIPTION

This is an extension to Date::HolidayParser that adds an interface that provides iCalendar-compatible data instead of the normal "raw" Date::HolidayParser format.

It ensures that UIDs generated are always the same, so you can depend upon them not changing between runs. The iCalendar data generated at the moment is very simple, and doesn't take into account recurrances (recurring events gets one event created per recurrance).

METHODS

You can run any method Date::HolidayParser supports on a Date::HolidayParser::iCalendar object (but then you should probably be using Date::HolidayParser instead). The methods documented here are all those needed to make use of Date::HolidayParser::iCalendar.

$object = Date::HolidayParser::iCalendar->new(FILE);

This is the main function. It creates a new Date::HolidayParser::iCalendar object for FILE and parses the file.

FILE must be the full path to the holiday file you want to parse.

$arrayRef = $object->list_events(YEAR,MONTH?,DAY?);

This returns an arrayRef, which contains one of three lists, depending on how many parameters are supplied:

Only year: An array containing a list of months (1-12) that has holidays
Year+Month: An array of days in said month that has holidays
All: A list of iCalendar UIDs referring to holidays on said date. These UIDs can be supplied to get_info() to retrieve the event.

$UID_Info = $object->get_info(UID);

Returns an iCalendar hash reference for the supplied UID or undef if the UID doesn't exist.

The hash returned is structured like this:

        %Hash = (
                ICAL_ENTRY => "ENTRY_VALUE",
                ANOTHER_ENTRY => "ANOTHER_VALUE",
        );

An example might look like this:

        %Hash = (
                'SUMMARY' => 'Monday',
                'UID' => 'D-HP-ICS-72-106-616',
                'DTEND' => '20060313',
                'DTSTART' => '20060313'
        );

AUTHOR

Eskild Hustvedt - <zerodogg@cpan.org>

BUGS

Please report any bugs or feature requests to bug-date-holidayparser@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-HolidayParser. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

LICENSE AND COPYRIGHT

Copyright (C) 2006, 2007, 2010 Eskild Hustvedt, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.