line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Storable.pm,v 0.3 2006/03/22 22:10:28 dankogai Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Tie::Storable; |
5
|
1
|
|
|
1
|
|
43325
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
7
|
1
|
|
|
1
|
|
7
|
use base 'Tie::SaveLater'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2141
|
|
8
|
|
|
|
|
|
|
our $VERSION = sprintf "%d.%02d", q$Revision: 0.3 $ =~ /(\d+)/g; |
9
|
1
|
|
|
1
|
|
1348
|
use Storable (); |
|
1
|
|
|
|
|
3552
|
|
|
1
|
|
|
|
|
32
|
|
10
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
190
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->make_subclasses; |
12
|
5
|
|
|
5
|
1
|
19
|
sub load{ Storable::retrieve($_[1]) }; |
13
|
8
|
|
|
8
|
1
|
41
|
sub save{ Storable::nstore($_[0], $_[0]->filename) }; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#### |
16
|
|
|
|
|
|
|
package Tie::Storable::More; |
17
|
1
|
|
|
1
|
|
7
|
use base 'Tie::SaveLater'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
84
|
|
18
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
225
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->make_subclasses; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub load{ |
22
|
2
|
|
|
2
|
|
5
|
my ($class, $filename) = @_; |
23
|
2
|
|
|
|
|
7
|
return Storable::retrieve($filename) |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub save{ |
27
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
28
|
2
|
50
|
|
|
|
6
|
if (my @options = $self->options){ |
29
|
2
|
100
|
|
|
|
9
|
return 1 unless ($options[0] & 0222); # do nothing if read-only |
30
|
|
|
|
|
|
|
} |
31
|
1
|
|
|
|
|
8
|
return Storable::nstore($self, $self->filename) |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub STORE{ |
35
|
2
|
|
|
2
|
|
900
|
my $self = shift; |
36
|
2
|
50
|
|
|
|
7
|
if (my @options = $self->options){ |
37
|
2
|
100
|
|
|
|
174
|
croak "This variable is read-only!" unless ($options[0] & 0222); |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
10
|
return $self->super_super('STORE' => @_); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |