2 package MooseX::Storage::Basic;
5 use MooseX::Storage::Engine;
11 my $e = MooseX::Storage::Engine->new( object => $self );
16 my ( $class, $data ) = @_;
17 my $e = MooseX::Storage::Engine->new( class => $class );
18 $class->new( $e->expand_object($data) );
29 MooseX::Storage::Basic - The simplest level of serialization
39 has 'x' => (is => 'rw', isa => 'Int');
40 has 'y' => (is => 'rw', isa => 'Int');
44 my $p = Point->new(x => 10, y => 10);
46 ## methods to pack/unpack an
47 ## object in perl data structures
49 # pack the class into a hash
50 $p->pack(); # { __CLASS__ => 'Point', x => 10, y => 10 }
52 # unpack the hash into a class
53 my $p2 = Point->unpack({ __CLASS__ => 'Point', x => 10, y => 10 });
57 This is the most basic form of serialization. This is used by default
58 but the exported C<Storage> function.
66 =item B<unpack ($data)>
80 All complex software has bugs lurking in it, and this module is no
81 exception. If you find a bug please either email me, or add the bug
86 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
88 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
90 =head1 COPYRIGHT AND LICENSE
92 Copyright 2007 by Infinity Interactive, Inc.
94 L<http://www.iinteractive.com>
96 This library is free software; you can redistribute it and/or modify
97 it under the same terms as Perl itself.