| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::WebMake::DataSources::SVFile; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Exporter; |
|
6
|
1
|
|
|
1
|
|
5
|
use HTML::WebMake::DataSourceBase; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
58
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
593
|
use vars qw{ |
|
11
|
|
|
|
|
|
|
@ISA @EXPORT |
|
12
|
1
|
|
|
1
|
|
4
|
}; |
|
|
1
|
|
|
|
|
2
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@ISA = qw(HTML::WebMake::DataSourceBase); |
|
15
|
|
|
|
|
|
|
@EXPORT = qw(); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
########################################################################### |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
|
20
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
21
|
0
|
|
0
|
|
|
|
$class = ref($class) || $class; |
|
22
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new (@_); |
|
23
|
0
|
|
|
|
|
|
bless ($self, $class); |
|
24
|
0
|
|
|
|
|
|
$self; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add { |
|
30
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
31
|
0
|
|
|
|
|
|
local ($_); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my @s; |
|
34
|
|
|
|
|
|
|
my @lines; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# if we're doing a , stat the .wmk file, and use the |
|
37
|
|
|
|
|
|
|
# passed-in text instead of loading it from an external file. |
|
38
|
|
|
|
|
|
|
# |
|
39
|
0
|
0
|
|
|
|
|
if (defined $self->{parent}->{ctable_wmkfile}) |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
0
|
|
|
|
|
|
$self->{src} = $self->{parent}->{ctable_wmkfile}->{filename}; |
|
42
|
0
|
|
|
|
|
|
@s = stat $self->{src}; |
|
43
|
0
|
|
|
|
|
|
@lines = split (/\n/, $self->{parent}->{ctable_text}); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} else { |
|
46
|
0
|
0
|
|
|
|
|
if (!open (IN, $self->{src})) { |
|
47
|
0
|
|
|
|
|
|
warn "can't open ".$self->as_string()." src file \"$self->{src}\": $!\n"; |
|
48
|
0
|
|
|
|
|
|
return; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
0
|
|
|
|
|
|
@s = stat IN; |
|
51
|
0
|
|
|
|
|
|
@lines = (); |
|
52
|
0
|
|
|
|
|
|
close IN; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->{main}->add_source_files ($self->{src}); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $patt = $self->{main}->{util}->glob_to_re ($self->{name}); |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $nfield = $self->{attrs}->{namefield}; |
|
60
|
0
|
|
|
|
|
|
my $vfield = $self->{attrs}->{valuefield}; |
|
61
|
0
|
|
|
|
|
|
my $delim = $self->{attrs}->{delimiter}; |
|
62
|
0
|
|
0
|
|
|
|
$nfield ||= 1; |
|
63
|
0
|
|
0
|
|
|
|
$vfield ||= 2; |
|
64
|
0
|
|
|
|
|
|
$nfield--; # adjust count-from-1 to -from-0 |
|
65
|
0
|
|
|
|
|
|
$vfield--; |
|
66
|
0
|
|
0
|
|
|
|
$delim ||= "\t"; |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
foreach $_ (@lines) { |
|
69
|
0
|
0
|
|
|
|
|
next unless /\S/; |
|
70
|
0
|
|
|
|
|
|
my @fields = split (/\Q${delim}\E/, $_); |
|
71
|
0
|
0
|
0
|
|
|
|
if (defined $fields[$nfield] && $fields[$nfield] =~ /^${patt}$/) |
|
72
|
|
|
|
|
|
|
{ |
|
73
|
0
|
|
|
|
|
|
my $name = $fields[$nfield]; |
|
74
|
0
|
|
0
|
|
|
|
$_ = $fields[$vfield]; $_ ||= ''; |
|
|
0
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# use this file's filename and stat details, so dependency checking |
|
77
|
|
|
|
|
|
|
# will work if the file changes |
|
78
|
0
|
|
|
|
|
|
my $wmkf = new HTML::WebMake::File($self->{main}, $self->{src}, $s[9]); |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $fixed = $self->{parent}->fixname ($name); |
|
81
|
0
|
|
|
|
|
|
$self->{parent}->add_file_to_list ($fixed); |
|
82
|
0
|
|
|
|
|
|
$self->{parent}->add_text ($fixed, $_, $self->{src}, $s[9]); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub get_location_contents { |
|
90
|
0
|
|
|
0
|
0
|
|
my ($self, $fname) = @_; |
|
91
|
0
|
|
|
|
|
|
croak __FILE__." get_location_contents called"; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# pretty simple for separated-value files: the modtime of values read |
|
97
|
|
|
|
|
|
|
# from such a file is the modtime of the SV file itself. |
|
98
|
|
|
|
|
|
|
# |
|
99
|
|
|
|
|
|
|
sub get_location_mod_time { |
|
100
|
0
|
|
|
0
|
0
|
|
my ($self, $fname) = @_; |
|
101
|
0
|
|
|
|
|
|
$fname =~ /^svfile:/; |
|
102
|
0
|
|
|
|
|
|
$self->{main}->cached_get_modtime ($'); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |