X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStorage.pm;h=57a33479262ca7e0a35097454a53ead9cbc3efbc;hb=c1830046f3b22e250cb83c7595b0f818edb47afc;hp=6d7f6e3da4a762d7d08833d986ea539fbd52d7a4;hpb=45d9a73cb319d9cd4d3e30d07526d72cb3e11ad2;p=gitmo%2FMooseX-Storage.git diff --git a/lib/MooseX/Storage.pm b/lib/MooseX/Storage.pm index 6d7f6e3..57a3347 100644 --- a/lib/MooseX/Storage.pm +++ b/lib/MooseX/Storage.pm @@ -64,6 +64,8 @@ MooseX::Storage - An serialization framework for Moose classes use Moose; use MooseX::Storage; + our $VERSION = '0.01'; + with Storage('format' => 'JSON', 'io' => 'File'); has 'x' => (is => 'rw', isa => 'Int'); @@ -77,20 +79,20 @@ MooseX::Storage - An serialization framework for Moose classes ## object in perl data structures # pack the class into a hash - $p->pack(); # { __CLASS__ => 'Point', x => 10, y => 10 } + $p->pack(); # { __CLASS__ => 'Point-0.01', x => 10, y => 10 } # unpack the hash into a class - my $p2 = Point->unpack({ __CLASS__ => 'Point', x => 10, y => 10 }); + my $p2 = Point->unpack({ __CLASS__ => 'Point-0.01', x => 10, y => 10 }); ## methods to freeze/thaw into ## a specified serialization format ## (in this case JSON) # pack the class into a JSON string - $p->freeze(); # { "__CLASS__" : "Point", "x" : 10, "y" : 10 } + $p->freeze(); # { "__CLASS__" : "Point-0.01", "x" : 10, "y" : 10 } # unpack the JSON string into a class - my $p2 = Point->thaw('{ "__CLASS__" : "Point", "x" : 10, "y" : 10 }'); + my $p2 = Point->thaw('{ "__CLASS__" : "Point-0.01", "x" : 10, "y" : 10 }'); ## methods to load/store a class ## on the file system