line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: DataDumper.pm,v 0.3 2006/03/22 22:10:28 dankogai Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Tie::DataDumper; |
5
|
1
|
|
|
1
|
|
41118
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
85
|
|
7
|
|
|
|
|
|
|
our $VERSION = sprintf "%d.%02d", q$Revision: 0.3 $ =~ /(\d+)/g; |
8
|
1
|
|
|
1
|
|
6
|
use base 'Tie::SaveLater'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
753
|
|
9
|
1
|
|
|
1
|
|
15
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
70
|
|
10
|
1
|
|
|
1
|
|
6
|
use Data::Dumper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
353
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->make_subclasses; |
12
|
|
|
|
|
|
|
sub load{ |
13
|
5
|
|
|
5
|
1
|
7
|
my $class = shift; |
14
|
5
|
|
|
|
|
7
|
my $filename = shift; |
15
|
5
|
50
|
|
|
|
196
|
open my $fh, "<:raw", $filename or croak "$filename: $!"; |
16
|
5
|
|
|
|
|
18
|
local $/; # slurp; |
17
|
5
|
|
|
|
|
96
|
my $str = <$fh>; |
18
|
5
|
|
|
|
|
52
|
close $fh; |
19
|
5
|
|
|
|
|
6
|
our $VAR1; # for data::dumper; |
20
|
5
|
|
|
|
|
536
|
my $result = eval($str); |
21
|
5
|
50
|
|
|
|
23
|
$@ and croak $@; |
22
|
5
|
|
|
|
|
8
|
undef $VAR1; |
23
|
5
|
|
|
|
|
36
|
return $result; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
sub save{ |
26
|
8
|
|
|
8
|
1
|
10
|
my $self = shift; |
27
|
8
|
|
|
|
|
32
|
my $filename = $self->filename; |
28
|
8
|
50
|
|
|
|
806
|
open my $fh, ">:raw", $filename or croak "$filename: $!"; |
29
|
8
|
|
|
|
|
34
|
print $fh Dumper($self); |
30
|
8
|
|
|
|
|
1452
|
close $fh; |
31
|
8
|
|
|
|
|
34
|
return 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |