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