DateTime::Format::Builder::Parser::Quick - Use another formatter, simply


DateTime-Format-Builder documentation  | view source Contained in the DateTime-Format-Builder distribution.

Index


NAME

Top

DateTime::Format::Builder::Parser::Quick - Use another formatter, simply

SYNOPSIS

Top

    use DateTime::Format::Builder (
    parsers => { parse_datetime => [
        { Quick => 'DateTime::Format::HTTP' },
        { Quick => 'DateTime::Format::Mail' },
        { Quick => 'DateTime::Format::IBeat' },
    ]});

is the same as:

    use DateTime::Format::HTTP;
    use DateTime::Format::Mail;
    use DateTime::Format::IBeat;

    use DateTime::Format::Builder (
    parsers => { parse_datetime => [
        sub { eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) } },
        sub { eval { DateTime::Format::Mail->parse_datetime( $_[1] ) } },
        sub { eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) } },
    ]});

(These two pieces of code can both be found in the test suite; one as quick.t, the other as fall.t.)

DESCRIPTION

Top

Quick adds a parser that allows some shortcuts when writing fairly standard and mundane calls to other formatting modules.

SPECIFICATION

Top

Quick has two keys, one optional.

The Quick keyword should have an argument of either an object or a class name. If it's a class name then the class is used.

The method keyword is optional with a default of parse_datetime. It's either name of the method to invoke on the object, or a reference to a piece of code.

In any case, the resultant code ends up looking like:

     my $rv = $Quick->$method( $date );

THANKS

Top

See the main module's section.

SUPPORT

Top

Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.

Alternatively, log them via the CPAN RT system via the web or email:

    http://perl.dellah.org/rt/dtbuilder
    bug-datetime-format-builder@rt.cpan.org

This makes it much easier for me to track things and thus means your problem is less likely to be neglected.

LICENCE AND COPYRIGHT

Top

AUTHOR

Top

Iain Truskett <spoon@cpan.org>

SEE ALSO

Top

datetime@perl.org mailing list.

http://datetime.perl.org/

perl, DateTime, DateTime::Format::Builder


DateTime-Format-Builder documentation  | view source Contained in the DateTime-Format-Builder distribution.