|
NAMEMooseX::Types::ISO8601 - ISO8601 date and duration string type constraints and coercions for MooseVERSIONversion 0.20SYNOPSISuse MooseX::Types::ISO8601 qw/ ISO8601DateTimeStr ISO8601TimeDurationStr /; has datetime => ( is => 'ro', isa => ISO8601DateTimeStr, ); has duration => ( is => 'ro', isa => ISO8601TimeDurationStr, coerce => 1, ); Class->new( datetime => '2012-01-01T00:00:00' ); Class->new( duration => 60 ); # 60s => PT00H01M00S Class->new( duration => DateTime::Duration->new(%args) ) DESCRIPTIONThis module packages several TypeConstraints with coercions for working with ISO8601 date strings and the DateTime suite of objects.DATE CONSTRAINTSISO8601DateStrAn ISO8601 date string. E.g. "2009-06-11"ISO8601TimeStrAn ISO8601 time string. E.g. "12:06:34Z"ISO8601DateTimeStrAn ISO8601 combined datetime string. E.g. "2009-06-11T12:06:34Z"ISO8601DateTimeTZStrAn ISO8601 combined datetime string with a fully specified timezone. E.g. "2009-06-11T12:06:34+00:00"ISO8601StrictDateStrISO8601StrictTimeStrISO8601StrictDateTimeStrISO8601StrictDateTimeTZStrAs above, only in addition to validating the strings against regular expressions, an attempt is made to actually parse the data into a DateTime object. This will catch cases like "2013-02-31" which look correct but do not correspond to real-world values. Note that this bears a computation penalty.COERCIONSThe date types will coerce from:
DURATION CONSTRAINTSISO8601DateDurationStrAn ISO8601 date duration string. E.g. "P01Y01M01D"ISO8601TimeDurationStrAn ISO8601 time duration string. E.g. "PT01H01M01S"ISO8601DateTimeDurationStrAn ISO8601 combined date and time duration string. E.g. "P01Y01M01DT01H01M01S"COERCIONSThe duration types will coerce from:
The duration types will coerce to:
FEATURESFractional secondsIf provided, the number of seconds in time types is represented to microsecond accuracy. A full stop character is used as the decimal separator, which is allowed, but deprecated in preference to the comma character in ISO 8601:2004.LIMITATIONSThis module is probably full of bugs; patches are very welcome.Specifically, there are missing features:
SEE ALSO
ACKNOWLEDGEMENTSThe development of this code was sponsored by my (Tom's) employer <http://www.state51.com/>.SUPPORTBugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-ISO8601> (or bug-MooseX-Types-ISO8601@rt.cpan.org <mailto:bug-MooseX-Types-ISO8601@rt.cpan.org>).There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/moose.html>. There is also an irc channel available for users of this distribution, at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>. AUTHORS
CONTRIBUTORS
COPYRIGHT AND LICENCEThis software is copyright (c) 2009 by Tomas Doran.This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Visit the GSP FreeBSD Man Page Interface. |