Andrew Green

NAME

XML::Generator::RSS10::ev - Support for the Event (ev) RSS 1.0 module

SYNOPSIS

    use XML::Generator::RSS10;
         use DateTime;
    
    my $rss = XML::Generator::RSS10->new( Handler => $sax_handler, modules => [ qw(ev) ] );
    
    $rss->item(
                title => 'Perl Poetry Recitals',
                link  => 'http://www.example.org/diary/perlpoetry.html',
                description => 'Some lovely Perl poetry, read loudly by Brian Blessed',
                ev => {
                   startdate => { year   => 2006,
                                  month  => 05,
                                  day    => 01,
                                  hour   => 19,
                                  minute => 00,
                                  second => 00,
                                  time_zone  => 'local'
                                },
                   enddate   => { year   => 2006,
                                  month  => 05,
                                  day    => 01,
                                  hour   => 20,
                                  minute => 00,
                                  second => 00,
                                  time_zone  => 'local',
                                },
                   location  => 'Town Hall, Exampleham, UK',
                   organizer => 'Example Organisation, info@example.org',
                   type      => 'Recital'
                }
              );
    
    $rss->channel(
                   title => 'Diary of Events',
                   link  => 'http://www.example.org/diary/',
                   description => 'Forthcoming example events'
                 );

DESCRIPTION

This module extends Dave Rolsky's XML::Generator::RSS10 to provide support for the Event (ev) RSS 1.0 module.

For full details of the Event module specification, see http://web.resource.org/rss/1.0/modules/event/.

Where event data is supplied, the startdate and enddate elements are required. These should be output in W3CDTF date/time format, as defined at http://www.w3.org/TR/NOTE-datetime. To help facilitate this, the module accepts four types of value for either element, which will be formatted to W3CDTF.

Define the date using a hashref

If the module is passed a hashref with date and time values as above, it will create a DateTime object from these and use DateTime::Format::W3CDTF to output in W3CDTF.

If the hashref doesn't contain any time values (hour, minute or second), the output won't either.

Pass a DateTime object directly

The module will use DateTime::Format::W3CDTF to output the date and time in the correct format.

Note: Since DateTime doesn't distinguish between a date with no time component and midnight, the output of this module when passed a DateTime object directly will always include a time.

Pass a scalar value in epoch seconds

Alternatively, a time value may be supplied in epoch seconds. This will be converted internally to a DateTime object, and thence formatted to W3CDTF.

Pass a string already in in W3CDTF

Any other scalar value passed as a startdate or enddate will be assumed to be already in W3CDTF, and will be output verbatim.

CHANGES

Version 0.01: Initial release.

SEE ALSO

XML::Generator::RSS10, DateTime, DateTime::Format::W3CDTF.

AUTHOR

Andrew Green, <andrew@article7.co.uk>.

Sponsored by Woking Borough Council, http://www.woking.gov.uk/.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.