NAME

MooseX::Storage::Format::JSONpm - a format role for MooseX::Storage using JSON.pm

VERSION

version 0.093090

SYNOPSIS

package Point;
our $VERSION = '0.093090';


use Moose;
use MooseX::Storage;

with Storage(format => 'JSONpm');

has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');

1;

my $p = Point->new(x => 10, y => 10);

# pack the class into a JSON string
my $json = $p->freeze(); # { "__CLASS__" : "Point", "x" : 10, "y" : 10 }

# unpack the JSON string into an object
my $p2 = Point->thaw($json);

METHODS

freeze

my $json = $obj->freeze;

thaw

my $obj = Class->thaw($json)

THANKS

Thanks to Stevan Little, Chris Prather, and Yuval Kogman, from whom I cribbed this code -- from MooseX::Storage::Format::JSON.

AUTHOR

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.