0.01 releaase
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Engine / IO / AtomicFile.pm
CommitLineData
12145c6e 1
2package MooseX::Storage::Engine::IO::AtomicFile;
3use Moose;
4
5use IO::AtomicFile;
6
e64b7302 7extends 'MooseX::Storage::Engine::IO::File';
12145c6e 8
9sub store {
10 my ($self, $data) = @_;
11 my $fh = IO::AtomicFile->new($self->file, 'w');
12 print $fh $data;
13 $fh->close()
14 || confess "Could not write atomic file (" . $self->file . ") because: $!";
15}
16
171;
18
19__END__
20
21=pod
22
23=head1 NAME
24
b477f392 25MooseX::Storage::Engine::IO::AtomicFile - The actually atomic file storage mechanism.
12145c6e 26
27=head1 DESCRIPTION
28
b477f392 29This provides the actual means to store data to a file atomically.
30
12145c6e 31=head1 METHODS
32
33=over 4
34
35=item B<file>
36
37=item B<load>
38
39=item B<store ($data)>
40
41=back
42
43=head2 Introspection
44
45=over 4
46
47=item B<meta>
48
49=back
50
51=head1 BUGS
52
53All complex software has bugs lurking in it, and this module is no
54exception. If you find a bug please either email me, or add the bug
55to cpan-RT.
56
57=head1 AUTHOR
58
59Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
60
61Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
62
63=head1 COPYRIGHT AND LICENSE
64
65Copyright 2007 by Infinity Interactive, Inc.
66
67L<http://www.iinteractive.com>
68
69This library is free software; you can redistribute it and/or modify
70it under the same terms as Perl itself.
71
72=cut