DateTimeX::Format - Moose Roles for building next generation DateTime formats


DateTimeX-Format documentation  | view source Contained in the DateTimeX-Format distribution.

Index


NAME

Top

DateTimeX::Format - Moose Roles for building next generation DateTime formats

SYNOPSIS

Top

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

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

	sub format_datetime {
		my ( $self, @args ) = @_;
	}

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

	$dtxf->debug(0);
	$dtxf->time_zone( $time_zone );
	$dtxf->locale( $locale );
	$dtxf->defaults(1);

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

	my $env = {
		time_zone  => $time_zone_for_call
		, locale  => $locale_for_call
	};
	my $dt = $dtxf->parse_datetime( $time, $env, @additional_arguments );
	my $dt = $dtxf->parse_datetime( $time, {time_zone=>$time_zone_for_call} )

	## if your module requires a pattern, or has variable time-input formats
	## see the Moose::Role DateTimeX::Format::CustomPattern
	package DateTimeX::Format::Strptime;
	use Moose;
	with 'DateTimeX::Format::CustomPattern';
	with 'DateTimeX::Format';




DESCRIPTION

Top

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

All of the DateTime based methods, locale and time_zone, coerce in accordence to what the docs of MooseX::Types::DateTime::ButMaintained say -- the coercions apply to both runtime calls and constructors.

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

Top

All of these slots correspond to your object 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::ButMaintained for informations about the coercions.

* time_zone

Can be overridden in the call to ->parse_datetime.

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

* 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

Top

new_datetime( $hashRef )

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

AUTHOR

Top

Evan Carroll, <me at evancarroll.com>

BUGS

Top

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

Top

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

perldoc DateTimeX::Format

You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTimeX-Format

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/DateTimeX-Format

* CPAN Ratings

http://cpanratings.perl.org/d/DateTimeX-Format

* Search CPAN

http://search.cpan.org/dist/DateTimeX-Format/

ACKNOWLEDGEMENTS

Top

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

COPYRIGHT & LICENSE

Top


DateTimeX-Format documentation  | view source Contained in the DateTimeX-Format distribution.