line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Index::Store::DataDumper; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Modules |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
27174
|
use Data::Dumper; |
|
2
|
|
|
|
|
21714
|
|
|
2
|
|
|
|
|
149
|
|
10
|
2
|
|
|
2
|
|
16
|
use File::Path; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
124
|
|
11
|
2
|
|
|
2
|
|
21
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
112
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require HTML::Index::Store; |
14
|
2
|
|
|
2
|
|
8
|
use vars qw( @ISA ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1839
|
|
15
|
|
|
|
|
|
|
@ISA = qw( HTML::Index::Store ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# Initialization public method |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init |
24
|
|
|
|
|
|
|
{ |
25
|
4
|
|
|
4
|
1
|
7
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
4
|
50
|
|
|
|
29
|
croak "No DB\n" unless defined $self->{DB}; |
28
|
4
|
|
100
|
|
|
26
|
$self->{MODE} ||= 'rw'; |
29
|
4
|
50
|
|
|
|
88
|
unless ( -d $self->{DB} ) |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
0
|
|
|
|
0
|
mkpath( $self->{DB} ) or croak "can't mkpath ", $self->{DB}, ": $!\n"; |
32
|
|
|
|
|
|
|
} |
33
|
4
|
|
|
|
|
31
|
$self->SUPER::init(); |
34
|
4
|
|
|
|
|
19
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub create_table |
38
|
|
|
|
|
|
|
{ |
39
|
16
|
|
|
16
|
1
|
23
|
my $self = shift; |
40
|
16
|
|
|
|
|
21
|
my $table = shift; |
41
|
|
|
|
|
|
|
|
42
|
16
|
|
|
|
|
45
|
my $path = $self->{DB} . "/$table.pl"; |
43
|
16
|
50
|
|
|
|
228
|
if ( -e $path ) |
44
|
|
|
|
|
|
|
{ |
45
|
16
|
100
|
|
|
|
41
|
if ( $self->{REFRESH} ) { unlink( $path ); } |
|
8
|
|
|
|
|
752
|
|
46
|
8
|
|
|
|
|
4588
|
else { $self->{$table} = do $path; } |
47
|
|
|
|
|
|
|
} |
48
|
16
|
|
|
|
|
140
|
$self->{PATH}{$table} = $path; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
# Destructor |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub DESTROY |
58
|
|
|
|
|
|
|
{ |
59
|
4
|
|
|
4
|
|
1417
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
4
|
100
|
|
|
|
259
|
return unless $self->{MODE} =~ /w/; |
62
|
2
|
|
|
|
|
6
|
for my $table ( keys %{$self->{PATH}} ) |
|
2
|
|
|
|
|
11
|
|
63
|
|
|
|
|
|
|
{ |
64
|
8
|
|
|
|
|
21
|
my $hash = $self->{$table}; |
65
|
8
|
|
|
|
|
19
|
my $path = $self->{PATH}{$table}; |
66
|
8
|
50
|
|
|
|
950
|
open( FH, ">$path" ) or die "Can't write to $path\n"; |
67
|
8
|
|
|
|
|
38
|
print FH Dumper( $hash ); |
68
|
8
|
|
|
|
|
1580
|
close( FH ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
# True |
75
|
|
|
|
|
|
|
# |
76
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |