Bump versions
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / IO / AtomicFile.pm
1
2 package MooseX::Storage::IO::AtomicFile;
3 use Moose::Role;
4
5 use MooseX::Storage::Engine::IO::AtomicFile;
6
7 our $VERSION   = '0.20';
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 with 'MooseX::Storage::IO::File';
11
12 sub store {
13     my ( $self, $filename, @args ) = @_;
14     MooseX::Storage::Engine::IO::AtomicFile->new( file => $filename )->store( $self->freeze(@args) );
15 }
16
17 1;
18
19 __END__
20
21 =pod
22
23 =head1 NAME
24
25 MooseX::Storage::IO::AtomicFile - An Atomic File I/O role
26
27 =head1 SYNOPSIS
28
29   package Point;
30   use Moose;
31   use MooseX::Storage;
32
33   with Storage('format' => 'JSON', 'io' => 'AtomicFile');
34
35   has 'x' => (is => 'rw', isa => 'Int');
36   has 'y' => (is => 'rw', isa => 'Int');
37
38   1;
39
40   my $p = Point->new(x => 10, y => 10);
41
42   ## methods to load/store a class
43   ## on the file system
44
45   $p->store('my_point.json');
46
47   my $p2 = Point->load('my_point.json');
48
49 =head1 METHODS
50
51 =over 4
52
53 =item B<load ($filename)>
54
55 =item B<store ($filename)>
56
57 =back
58
59 =head2 Introspection
60
61 =over 4
62
63 =item B<meta>
64
65 =back
66
67 =head1 BUGS
68
69 All complex software has bugs lurking in it, and this module is no
70 exception. If you find a bug please either email me, or add the bug
71 to cpan-RT.
72
73 =head1 AUTHOR
74
75 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
76
77 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
78
79 =head1 COPYRIGHT AND LICENSE
80
81 Copyright 2007-2008 by Infinity Interactive, Inc.
82
83 L<http://www.iinteractive.com>
84
85 This library is free software; you can redistribute it and/or modify
86 it under the same terms as Perl itself.
87
88 =cut
89
90