1 package MooseX::Storage::IO::File;
4 use MooseX::Storage::Engine::IO::File;
10 my ( $class, $filename, @args ) = @_;
11 $class->thaw( MooseX::Storage::Engine::IO::File->new( file => $filename )->load(), @args );
15 my ( $self, $filename, @args ) = @_;
16 MooseX::Storage::Engine::IO::File->new( file => $filename )->store( $self->freeze(@args) );
29 MooseX::Storage::IO::File - A basic File I/O role
37 with Storage('format' => 'JSON', 'io' => 'File');
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 load/store a class
49 $p->store('my_point.json');
51 my $p2 = Point->load('my_point.json');
57 =item B<load ($filename)>
59 =item B<store ($filename)>
73 All complex software has bugs lurking in it, and this module is no
74 exception. If you find a bug please either email me, or add the bug
79 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
81 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
83 =head1 COPYRIGHT AND LICENSE
85 Copyright 2007-2008 by Infinity Interactive, Inc.
87 L<http://www.iinteractive.com>
89 This library is free software; you can redistribute it and/or modify
90 it under the same terms as Perl itself.