Dave Rolsky > DateTime-Format-Builder > DateTime::Format::Builder::Parser::Dispatch

Download:
DateTime-Format-Builder-0.81.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  2
View/Report Bugs
Module Version: 0.81   Source  

NAME ^

DateTime::Format::Builder::Parser::Dispatch - Dispatch parsers by group

VERSION ^

version 0.81

SYNOPSIS ^

    package SampleDispatch;
    use DateTime::Format::Builder
    (
        parsers => {
            parse_datetime => [
                {
                    Dispatch => sub {
                        return 'fnerk';
                    }
                }
            ]
        },
        groups => {
            fnerk => [
                {
                    regex => qr/^(\d{4})(\d\d)(\d\d)$/,
                    params => [qw( year month day )],
                },
            ]
        }
    );

DESCRIPTION ^

Dispatch adds another parser type to Builder permitting dispatch of parsing according to group names.

SPECIFICATION ^

Dispatch has just one key: Dispatch. The value should be a reference to a subroutine that returns one of:

Groups are specified much like the example in the SYNOPSIS. They follow the same format as when you specify them for methods.

SIDEEFFECTS ^

Your group parser can also be a Dispatch parser. Thus you could potentially end up with an infinitely recursive parser.

SUPPORT ^

See DateTime::Format::Builder for details.

SEE ALSO ^

datetime@perl.org mailing list.

http://datetime.perl.org/

perl, DateTime, DateTime::Format::Builder

AUTHORS ^

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2013 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: