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