The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Types::ISO8601 - ISO8601 date and duration string type constraints and coercions for Moose

SYNOPSIS

    use MooseX::Types::ISO8601 qw/ISO8601DurationStr/;

    has duration => (
        isa => ISO8601DurationStr,
        is => 'ro',
        coerce => 1,
    );

    Class->new( duration => 60 ); # 60s => PT00H01M00S
    Class->new( duration => DateTime::Duration->new(%args) )

DESCRIPTION

This module packages several TypeConstraints with coercions, designed to work with the DateTime suite of objects.

CONSTRAINTS

ISO8601DurationStr

An ISO8601 duration string

from Num

The number is treated as a time in seconds

from DateTime::Duration

The duration represented as a DateTime::Duration object.

SEE ALSO

MooseX::Types::DateTime
DateTime
DateTime::Duration
DateTime::Format::Duration

VERSION CONTROL

    http://github.com/bobtfish/moosex-types-iso8601/tree/master

BUGS

Probably full of them, patches are very welcome.

Specifically missing features:

Currently no time string support, just durations
Duration string support only supports durations measured in hours
No timezone string support
Unsure if strings are proprly accurate to the spec
Tests are rubbish.

AUTHOR

Tomas Doran (t0m) <bobtfish@bobtfish.net>

The development of this code was sponsored by my employer http://www.state51.co.uk.

COPYRIGHT

    Copyright (c) 2009 Tomas Doran. Some rights reserved.
    This program is free software; you can redistribute
    it and/or modify it under the same terms as Perl itself.