line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hub::Parse::Template; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Hub qw/:lib/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
push our @ISA, qw/Hub::Base::Object/; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '4.00043'; |
9
|
|
|
|
|
|
|
our @EXPORT = qw//; |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw//; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
13
|
|
|
|
|
|
|
# refresh - Reset to initial state (persistent object method) |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# refresh FILESPEC |
16
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub refresh { |
19
|
0
|
|
|
0
|
1
|
|
my ($self,$opts) = Hub::objopts( \@_ ); |
20
|
0
|
|
|
|
|
|
my $spec = shift; |
21
|
0
|
|
|
|
|
|
$self->{'parser'} = mkinst( 'FileParser', $spec ); |
22
|
0
|
0
|
|
|
|
|
Hub::merge( $self->{'public:'}, @_ ) if @_; |
23
|
|
|
|
|
|
|
}#refresh |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
26
|
|
|
|
|
|
|
# comptv - Compose template value |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# comptv ADDRESS, FILESPEC, [VALUE] |
29
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub comptv { |
32
|
0
|
|
|
0
|
1
|
|
my ($self,$opts) = Hub::objopts( \@_ ); |
33
|
0
|
|
|
|
|
|
my ($k,$template) = (shift,shift); |
34
|
0
|
|
|
|
|
|
map { |
35
|
0
|
|
|
|
|
|
my $template = Hub::mkinst( 'Template', $template, $_ ); |
36
|
0
|
|
|
|
|
|
Hub::happendv( $self->{'public:'}, $k, $template, '-asa=1' ); |
37
|
|
|
|
|
|
|
} @_; |
38
|
|
|
|
|
|
|
}#comptv |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
41
|
|
|
|
|
|
|
# compfv - Compose formatted value |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# compfv ADDRESS, FORMAT, [VALUE] |
44
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub compfv { |
47
|
0
|
|
|
0
|
1
|
|
my ($self,$opts) = Hub::objopts( \@_ ); |
48
|
0
|
|
|
|
|
|
my ($k,$format) = (shift,shift); |
49
|
0
|
|
|
|
|
|
map { |
50
|
0
|
|
|
|
|
|
my $template = { |
51
|
|
|
|
|
|
|
'text' => $format, |
52
|
|
|
|
|
|
|
'value' => $_, |
53
|
|
|
|
|
|
|
}; |
54
|
0
|
|
|
|
|
|
Hub::happendv( $self->{'public:'}, $k, $template, '-asa=1' ); |
55
|
|
|
|
|
|
|
} @_; |
56
|
|
|
|
|
|
|
}#compfv |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
59
|
|
|
|
|
|
|
# compdv - Compose data value |
60
|
|
|
|
|
|
|
# |
61
|
|
|
|
|
|
|
# compdv ADDRESS, VALUE... |
62
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub compdv { |
65
|
0
|
|
|
0
|
1
|
|
my ($self,$opts) = Hub::objopts( \@_ ); |
66
|
0
|
|
|
|
|
|
my $k = shift; |
67
|
0
|
|
|
|
|
|
map { Hub::happendv( $self->{'public:'}, $k, $_, '-asa=1' ) } @_; |
|
0
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
}#compdv |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
71
|
|
|
|
|
|
|
# populate - Return a populated version of this template. |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
# populate [\HASH]... |
74
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub populate { |
77
|
0
|
|
|
0
|
1
|
|
my ($self,$opts) = Hub::objopts( \@_ ); |
78
|
0
|
|
|
|
|
|
return $self->{'parser'}->populate( |
79
|
|
|
|
|
|
|
$self->{'public:'}, @_, -opts => $opts ); |
80
|
|
|
|
|
|
|
}#populate |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
83
|
|
|
|
|
|
|
1; |