adding support for Deferred
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Basic.pm
index 38622ff..d43d26a 100644 (file)
@@ -4,16 +4,19 @@ use Moose::Role;
 
 use MooseX::Storage::Engine;
 
+our $VERSION   = '0.01';
+our $AUTHORITY = 'cpan:STEVAN';
+
 sub pack {
-    my $self = shift;
+    my ( $self, @args ) = @_;
     my $e = MooseX::Storage::Engine->new( object => $self );
-    $e->collapse_object;
+    $e->collapse_object(@args);
 }
 
 sub unpack {
-    my ( $class, $data ) = @_;
+    my ( $class, $data, @args ) = @_;
     my $e = MooseX::Storage::Engine->new( class => $class );
-    $class->new( $e->expand_object($data) );
+    $class->new( $e->expand_object($data, @args) );
 }
 
 1;
@@ -32,6 +35,8 @@ MooseX::Storage::Basic - The simplest level of serialization
   use Moose;
   use MooseX::Storage;
   
+  our $VERSION = '0.01';
+  
   with Storage;
   
   has 'x' => (is => 'rw', isa => 'Int');
@@ -45,10 +50,10 @@ MooseX::Storage::Basic - The simplest level of serialization
   ## 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 });
 
 =head1 DESCRIPTION
 
@@ -87,7 +92,7 @@ Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2007 by Infinity Interactive, Inc.
+Copyright 2007-2008 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>