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