File Coverage

blib/lib/MooseX/Storage/IO/AtomicFile.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 16 16 100.0


line stmt bran cond sub pod time code
1             package MooseX::Storage::IO::AtomicFile;
2             # ABSTRACT: An Atomic File I/O role
3              
4             our $VERSION = '0.53';
5              
6 3     3   1454 use Moose::Role;
  3         7  
  3         18  
7 3     3   14385 use MooseX::Storage::Engine::IO::AtomicFile;
  3         8  
  3         94  
8 3     3   18 use namespace::autoclean;
  3         5  
  3         12  
9              
10             with 'MooseX::Storage::IO::File';
11              
12             sub store {
13 4     4 1 13840 my ( $self, $filename, @args ) = @_;
14 4         42 MooseX::Storage::Engine::IO::AtomicFile->new( file => $filename )->store( $self->freeze(@args) );
15             }
16              
17             1;
18              
19             __END__
20              
21             =pod
22              
23             =encoding UTF-8
24              
25             =head1 NAME
26              
27             MooseX::Storage::IO::AtomicFile - An Atomic File I/O role
28              
29             =head1 VERSION
30              
31             version 0.53
32              
33             =head1 SYNOPSIS
34              
35             package Point;
36             use Moose;
37             use MooseX::Storage;
38              
39             with Storage('format' => 'JSON', 'io' => 'AtomicFile');
40              
41             has 'x' => (is => 'rw', isa => 'Int');
42             has 'y' => (is => 'rw', isa => 'Int');
43              
44             1;
45              
46             my $p = Point->new(x => 10, y => 10);
47              
48             ## methods to load/store a class
49             ## on the file system
50              
51             $p->store('my_point.json');
52              
53             my $p2 = Point->load('my_point.json');
54              
55             =head1 METHODS
56              
57             =over 4
58              
59             =item B<load ($filename)>
60              
61             =item B<store ($filename)>
62              
63             =back
64              
65             =head1 SUPPORT
66              
67             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage>
68             (or L<bug-MooseX-Storage@rt.cpan.org|mailto:bug-MooseX-Storage@rt.cpan.org>).
69              
70             There is also a mailing list available for users of this distribution, at
71             L<http://lists.perl.org/list/moose.html>.
72              
73             There is also an irc channel available for users of this distribution, at
74             L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
75              
76             =head1 AUTHORS
77              
78             =over 4
79              
80             =item *
81              
82             Chris Prather <chris.prather@iinteractive.com>
83              
84             =item *
85              
86             Stevan Little <stevan.little@iinteractive.com>
87              
88             =item *
89              
90             יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
91              
92             =back
93              
94             =head1 COPYRIGHT AND LICENSE
95              
96             This software is copyright (c) 2007 by Infinity Interactive, Inc.
97              
98             This is free software; you can redistribute it and/or modify it under
99             the same terms as the Perl 5 programming language system itself.
100              
101             =cut