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