roles
[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
7has file => (
8 isa => 'Str',
9 is => 'ro',
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
251;