refactor Storage output into an IO engine to allow better flexability
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / IO / File.pm
1
2 package MooseX::Storage::IO::File;
3 use Moose;
4
5 has file => (
6         isa => 'Str',
7         is  => 'ro',
8         required => 1,
9 );
10
11 sub load { 
12         my ($self) = @_;
13         my $fh = IO::File->new($self->file, 'r');
14         return do { local $/; <$fh>; };
15 }
16
17 sub store {
18         my ($self, $data) = @_;
19         my $fh = IO::File->new($self->file, 'w');
20         print $fh $data;
21 }