more tweaks for 0.01
[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
7b428d1f 7our $VERSION = '0.01';
8
ec9c1923 9has 'file' => (
10 is => 'ro',
11 isa => 'Str',
a23e18d7 12 required => 1,
13);
14
15sub load {
16 my ($self) = @_;
17 my $fh = IO::File->new($self->file, 'r');
18 return do { local $/; <$fh>; };
19}
20
21sub store {
22 my ($self, $data) = @_;
23 my $fh = IO::File->new($self->file, 'w');
24 print $fh $data;
4d1850a6 25}
26
ec9c1923 271;
28
29__END__
30
31=pod
32
33=head1 NAME
34
b477f392 35MooseX::Storage::Engine::IO::File - The actually file storage mechanism.
ec9c1923 36
37=head1 DESCRIPTION
38
b477f392 39This provides the actual means to store data to a file.
40
ec9c1923 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
63All complex software has bugs lurking in it, and this module is no
64exception. If you find a bug please either email me, or add the bug
65to cpan-RT.
66
67=head1 AUTHOR
68
69Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
70
71Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
72
73=head1 COPYRIGHT AND LICENSE
74
75Copyright 2007 by Infinity Interactive, Inc.
76
77L<http://www.iinteractive.com>
78
79This library is free software; you can redistribute it and/or modify
80it under the same terms as Perl itself.
81
82=cut