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.50'; |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1774
|
use Moose::Role; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
25
|
|
7
|
3
|
|
|
3
|
|
15754
|
use MooseX::Storage::Engine::IO::AtomicFile; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
95
|
|
8
|
3
|
|
|
3
|
|
18
|
use namespace::autoclean; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
15
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'MooseX::Storage::IO::File'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub store { |
13
|
4
|
|
|
4
|
1
|
14561
|
my ( $self, $filename, @args ) = @_; |
14
|
4
|
|
|
|
|
52
|
MooseX::Storage::Engine::IO::AtomicFile->new( file => $filename )->store( $self->freeze(@args) ); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
3
|
|
401
|
no Moose::Role; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
24
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=encoding UTF-8 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
MooseX::Storage::IO::AtomicFile - An Atomic File I/O role |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 VERSION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
version 0.50 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
package Point; |
38
|
|
|
|
|
|
|
use Moose; |
39
|
|
|
|
|
|
|
use MooseX::Storage; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
with Storage('format' => 'JSON', 'io' => 'AtomicFile'); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has 'x' => (is => 'rw', isa => 'Int'); |
44
|
|
|
|
|
|
|
has 'y' => (is => 'rw', isa => 'Int'); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $p = Point->new(x => 10, y => 10); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
## methods to load/store a class |
51
|
|
|
|
|
|
|
## on the file system |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$p->store('my_point.json'); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $p2 = Point->load('my_point.json'); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over 4 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item B<load ($filename)> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item B<store ($filename)> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=back |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 Introspection |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over 4 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item B<meta> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 BUGS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
All complex software has bugs lurking in it, and this module is no |
78
|
|
|
|
|
|
|
exception. If you find a bug please or add the bug to cpan-RT |
79
|
|
|
|
|
|
|
at L<https://rt.cpan.org/Dist/Display.html?Queue=MooseX-Storage>. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHORS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Chris Prather <chris.prather@iinteractive.com> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Stevan Little <stevan.little@iinteractive.com> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Infinity Interactive, Inc.. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
104
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |