moose / MooseX-Storage

A serialization framework for Moose classes
http://metacpan.org/release/MooseX-Storage/
Other
6 stars 11 forks source link

(docs) fix usage of DateTime->new #8

Closed sillitoe closed 9 years ago

sillitoe commented 9 years ago

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).

karenetheridge commented 9 years ago

Thanks, merged! I'll open a wishlist RT item for handling MooseX::Type and Type::Tiny objects.