line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: DataDumper.pm,v 0.05 2020/08/05 18:26:03 dankogai Exp dankogai $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Tie::DataDumper; |
5
|
1
|
|
|
1
|
|
76676
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
7
|
|
|
|
|
|
|
our $VERSION = sprintf "%d.%02d", q$Revision: 0.05 $ =~ /(\d+)/g; |
8
|
1
|
|
|
1
|
|
6
|
use base 'Tie::SaveLater'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
451
|
|
9
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
10
|
1
|
|
|
1
|
|
5
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
254
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->make_subclasses; |
12
|
|
|
|
|
|
|
sub load{ |
13
|
5
|
|
|
5
|
1
|
9
|
my $class = shift; |
14
|
5
|
|
|
|
|
9
|
my $filename = shift; |
15
|
5
|
50
|
|
|
|
173
|
open my $fh, "<:raw", $filename or croak "$filename: $!"; |
16
|
5
|
|
|
|
|
31
|
local $/; # slurp; |
17
|
5
|
|
|
|
|
95
|
my $str = <$fh>; |
18
|
5
|
|
|
|
|
46
|
close $fh; |
19
|
5
|
|
|
|
|
11
|
our $VAR1; # for data::dumper; |
20
|
5
|
|
|
|
|
430
|
my $result = eval($str); |
21
|
5
|
50
|
|
|
|
25
|
$@ and croak $@; |
22
|
5
|
|
|
|
|
8
|
undef $VAR1; |
23
|
5
|
|
|
|
|
33
|
return $result; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
sub save{ |
26
|
8
|
|
|
8
|
1
|
13
|
my $self = shift; |
27
|
8
|
|
|
|
|
22
|
my $filename = $self->filename; |
28
|
8
|
50
|
|
|
|
1071
|
open my $fh, ">:raw", $filename or croak "$filename: $!"; |
29
|
8
|
|
|
|
|
51
|
print $fh Dumper($self); |
30
|
8
|
|
|
|
|
1337
|
close $fh; |
31
|
8
|
|
|
|
|
56
|
return 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |