Commit | Line | Data |
---|---|---|
a23e18d7 | 1 | |
4d1850a6 | 2 | package MooseX::Storage::Engine::IO::File; |
a23e18d7 | 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; | |
4d1850a6 | 23 | } |
24 | ||
25 | 1; |