roles
[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 has file => (
8         isa => 'Str',
9         is  => 'ro',
10         required => 1,
11 );
12
13 sub load { 
14         my ($self) = @_;
15         my $fh = IO::File->new($self->file, 'r');
16         return do { local $/; <$fh>; };
17 }
18
19 sub store {
20         my ($self, $data) = @_;
21         my $fh = IO::File->new($self->file, 'w');
22         print $fh $data;
23 }
24
25 1;