line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tree::Persist::File; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2051
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use base qw( Tree::Persist::Base ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
77
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Scalar::Util qw( blessed ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
163
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.11'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ---------------------------------------------- |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _init |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
|
|
my($class) = shift; |
17
|
0
|
|
|
|
|
|
my($opts) = @_; |
18
|
0
|
|
|
|
|
|
my($self) = $class -> SUPER::_init( $opts ); |
19
|
0
|
|
|
|
|
|
$self->{_filename} = $opts->{filename}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $self; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} # End of _init. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ---------------------------------------------- |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _create |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
|
|
my($self) = shift; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
open my $fh, '>', $self->{_filename} |
32
|
0
|
0
|
|
|
|
|
or die "Cannot open '$self->{_filename}' for writing: $!\n"; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
print $fh $self->_build_string( $self->{_tree} ); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
close $fh; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $self; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} # End of _create. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# ---------------------------------------------- |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
*_commit = \&_create; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# ---------------------------------------------- |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |