more tweaks for 0.01
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Engine / IO / File.pm
1
2 package MooseX::Storage::Engine::IO::File;
3 use Moose;
4
5 use IO::File;
6
7 our $VERSION = '0.01';
8
9 has 'file' => (
10         is       => 'ro',
11         isa      => 'Str',      
12         required => 1,
13 );
14
15 sub load { 
16         my ($self) = @_;
17         my $fh = IO::File->new($self->file, 'r');
18         return do { local $/; <$fh>; };
19 }
20
21 sub store {
22         my ($self, $data) = @_;
23         my $fh = IO::File->new($self->file, 'w');
24         print $fh $data;
25 }
26
27 1;
28
29 __END__
30
31 =pod
32
33 =head1 NAME
34
35 MooseX::Storage::Engine::IO::File - The actually file storage mechanism.
36
37 =head1 DESCRIPTION
38
39 This provides the actual means to store data to a file.
40
41 =head1 METHODS
42
43 =over 4
44
45 =item B<file>
46
47 =item B<load>
48
49 =item B<store ($data)>
50
51 =back
52
53 =head2 Introspection
54
55 =over 4
56
57 =item B<meta>
58
59 =back
60
61 =head1 BUGS
62
63 All complex software has bugs lurking in it, and this module is no 
64 exception. If you find a bug please either email me, or add the bug
65 to cpan-RT.
66
67 =head1 AUTHOR
68
69 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
70
71 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
72
73 =head1 COPYRIGHT AND LICENSE
74
75 Copyright 2007 by Infinity Interactive, Inc.
76
77 L<http://www.iinteractive.com>
78
79 This library is free software; you can redistribute it and/or modify
80 it under the same terms as Perl itself.
81
82 =cut