DateTime->iso8601 returns a string, but DateTime->new( string ) throws an error:
Odd number of parameters in call to DateTime::new
I've added a DateTime::Format parser to make this example work, but the extra dependency may be more confusing?
An alternative example (without the dependency) could be handling Path::Class (or MooseX::Types::Path::Class):
MooseX::Storage::Engine->add_custom_type_handler(
'MooseX::Types::Path::Class::File' => (
expand => sub { Path::Class::File->new( shift ) },
collapse => sub { (shift)->stringify },
)
);
There might be some value in explicitly mentioning how to add handle MooseX::Types:: anyway (I remember that being a gotcha when I first tried to use this module).
DateTime->iso8601 returns a string, but DateTime->new( string ) throws an error:
I've added a DateTime::Format parser to make this example work, but the extra dependency may be more confusing?
An alternative example (without the dependency) could be handling
Path::Class
(orMooseX::Types::Path::Class
):There might be some value in explicitly mentioning how to add handle
MooseX::Types::
anyway (I remember that being a gotcha when I first tried to use this module).