From: Chris Prather Date: Tue, 28 Feb 2012 23:15:11 +0000 (-0500) Subject: add documentation for add_custom_type_handler to MooseX::Storage::Engine X-Git-Tag: 0.31~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cb5340111da3fd7850ad5702f02d255d0910b32a;p=gitmo%2FMooseX-Storage.git add documentation for add_custom_type_handler to MooseX::Storage::Engine --- diff --git a/Changes b/Changes index f24ac17..5130af2 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for MooseX-Storage {{NEXT}} + * Add example for add_custom_type_handler to the MooseX::Storage::Engine docs. (perigrin) + * Incorrect documentation for ->unpack method's inject parameter fixed. * The test suite now uses Test::Fatal instead of Test::Exception (Karen diff --git a/lib/MooseX/Storage/Engine.pm b/lib/MooseX/Storage/Engine.pm index f120668..0833de2 100644 --- a/lib/MooseX/Storage/Engine.pm +++ b/lib/MooseX/Storage/Engine.pm @@ -374,7 +374,17 @@ MooseX::Storage::Engine - The meta-engine to handle collapsing and expanding obj =head1 DESCRIPTION -No user serviceable parts inside. If you really want to know, read the source :) +There really aren't any major user serviceable parts here. However the typical +use case is adding new non-Moose classes to the type registry for +serialization. Here is an example of this for DateTime objects. This +assumes a C type has been registered. + + MooseX::Storage::Engine->add_custom_type_handler( + 'DateTime' => ( + expand => sub { DateTime->new(shift) }, + collapse => sub { (shift)->iso8601 }, + ) + ); =head1 METHODS