The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DateTimeX::Format - A base class for building next generation DateTime abstraction layers

SYNOPSIS

        package DateTimeX::Format::Bleh;
        with 'DateTimeX::Format';

        ## If your module doesn't require a user sent pattern
        has '+pattern' => ( default => 'Undef' );

        sub parse_datetime {
                my ( $time, $env, @args ) = @_;
                # expr;
        }

        my $dt = DateTimeX::Format::Bleh->new({
                locale     => $locale
                , timezone => $timezone
                , debug    => 0|1
                , defaults =>0|1
        });

        $dt->debug(0);
        $dt->timezone( $timezone );
        $dt->locale( $locale );
        $dt->pattern( $pattern );
        $dt->defaults(1);

        $dt->parse_datetime( $time, {locale=>$locale_for_call} );

        my $env = {
                timezone  => $timezone_for_call
                , locale  => $locale_for_call
        };
        $dt->parse_datetime( $time, $env, @additional_arguments );

        $dt->parse_datetime( $time, {timezone=>$timezone_for_call} )

DESCRIPTION

This Moose::Role simply provides an environment at instantation which can be overriden in the call to parse_data by supplying a hash.

All of the DateTime based methods, locale and timezone, coerce in accordence to what the docs of MooseX::Types::DateTime say -- the coercions only occur in the constructor.

In addition this module provides two other accessors to assist in the development of modules in the DateTimeX::Format namespace, these are debug, and defaults.

OBJECT ENVIRONMENT

All of these slots correspond to the environment: they can be supplied in the constructor or through accessors.

  • locale

    Can be overridden in the call to ->parse_datetime.

    See the docs at MooseX::Types::DateTime for informations about the coercions.

  • timezone

    Can be overridden in the call to ->parse_datetime.

    See the docs at MooseX::Types::DateTime for informations about the coercions.

  • pattern( $str )

    Can be overridden in the call to ->parse_datetime.

  • debug( 1 | 0* )

    Set to one to get debugging information

  • defaults( 1* | 0 )

    Set to 0 to force data to be sent to the module

HELPER FUNCTIONS

new_datetime( $hashRef )

Takes a hashRef of the name value pairs to hand off to DateTime->new

AUTHOR

Evan Carroll, <me at evancarroll.com>

BUGS

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

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc DateTimeX::Format

You can also look for information at:

ACKNOWLEDGEMENTS

Dave Rolsky -- provided a some assistance with how DateTime works

COPYRIGHT & LICENSE

Copyright 2009 Evan Carroll, all rights reserved.

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