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
37 our $VERSION = '0.01';
41 has 'x' => (is => 'rw', isa => 'Int');
42 has 'y' => (is => 'rw', isa => 'Int');
46 my $p = Point->new(x => 10, y => 10);
48 ## methods to pack/unpack an
49 ## object in perl data structures
51 # pack the class into a hash
52 $p->pack(); # { __CLASS__ => 'Point-0.01', x => 10, y => 10 }
54 # unpack the hash into a class
55 my $p2 = Point->unpack({ __CLASS__ => 'Point-0.01', x => 10, y => 10 });
59 This is the most basic form of serialization. This is used by default
60 but the exported C<Storage> function.
68 =item B<unpack ($data)>
82 All complex software has bugs lurking in it, and this module is no
83 exception. If you find a bug please either email me, or add the bug
88 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
90 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
92 =head1 COPYRIGHT AND LICENSE
94 Copyright 2007 by Infinity Interactive, Inc.
96 L<http://www.iinteractive.com>
98 This library is free software; you can redistribute it and/or modify
99 it under the same terms as Perl itself.