This example expands upon the Types::Datetime library defined in Type::Tiny::Manual::Libraries. It defines class types for DateTime and DateTime::Duration and some structured types for hashes that can be used to instantiate DateTime objects. It defines some coercions for the Datetime class type.
Datetime
A simple Moose class is provided using some of these types and coercions. The class also defines a couple of extra coercions inline.
See the source code of this file for the actual example code.
Moose, DateTime.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Type::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Type::Tiny
CPAN shell
perl -MCPAN -e shell install Type::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.