| 1 | package Web::NewsAPI::Types; | ||
| 2 | |||
| 3 | use Moose::Util::TypeConstraints; | ||
| 4 | |||
| 5 | subtype 'NewsDateTime', as 'DateTime'; | ||
| 6 | subtype 'NewsURI', as 'Maybe[URI]'; | ||
| 7 | |||
| 8 | coerce 'NewsDateTime', | ||
| 9 | from 'Str', | ||
| 10 | via { DateTime::Format::ISO8601->parse_datetime( $_ ) }; | ||
| 11 | |||
| 12 | coerce 'NewsURI', | ||
| 13 | from 'Str', | ||
| 14 | via { URI->new( $_ ) }; | ||
| 15 | |||
| 16 | |||
| 17 | 1; |