line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Template::Base; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
80
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
60
|
BEGIN { |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
|
|
480
|
use PDF::Template::Constants qw( |
9
|
|
|
|
|
|
|
%Verify |
10
|
3
|
|
|
3
|
|
1333
|
); |
|
3
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
1382
|
use PDF::Template::Factory; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1996
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
0
|
18
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
9
|
push @_, %{shift @_} while UNIVERSAL::isa($_[0], 'HASH'); |
|
0
|
|
|
|
|
0
|
|
19
|
1
|
50
|
|
|
|
6
|
(@_ % 2) && die "$class->new() called with odd number of option parameters", $/; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
2
|
my %x = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Do not use a hashref-slice here because of the uppercase'ing |
24
|
1
|
|
|
|
|
2
|
my $self = {}; |
25
|
1
|
|
|
|
|
24
|
$self->{uc $_} = $x{$_} for keys %x; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
4
|
$self->{__THIS_HAS_RENDERED__} = 0; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
4
|
bless $self, $class; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
0
|
87
|
sub isa { PDF::Template::Factory::isa(@_) } |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# These functions are used in the P::T::Container & P::T::Element hierarchies |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _validate_option |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
0
|
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my ($option, $val_ref) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$option = uc $option; |
42
|
0
|
0
|
0
|
|
|
|
return 1 unless exists $Verify{$option} && UNIVERSAL::isa($Verify{$option}, 'HASH'); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if (defined $val_ref) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
45
|
|
|
|
|
|
|
{ |
46
|
0
|
0
|
|
|
|
|
if (!defined $$val_ref) |
|
|
0
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
|
|
|
$$val_ref = $Verify{$option}{'__DEFAULT__'}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif (!exists $Verify{$option}{$$val_ref}) |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
|
|
|
my $name = ucfirst lc $option; |
53
|
0
|
|
|
|
|
|
warn "$name '$$val_ref' unsupported. Defaulting to '$Verify{$option}{'__DEFAULT__'}'", $/; |
54
|
0
|
|
|
|
|
|
$$val_ref = $Verify{$option}{'__DEFAULT__'}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
elsif (!defined $self->{$option}) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
$self->{$option} = $Verify{$option}{'__DEFAULT__'}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif (!exists $Verify{$option}{$self->{$option}}) |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
|
my $name = ucfirst lc $option; |
64
|
0
|
|
|
|
|
|
warn "$name '$self->{$option}' unsupported. Defaulting to '$Verify{$option}{'__DEFAULT__'}'", $/; |
65
|
0
|
|
|
|
|
|
$self->{$option} = $Verify{$option}{'__DEFAULT__'}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
0
|
|
sub calculate { ($_[1])->get(@_[0,2]) } |
72
|
|
|
|
|
|
|
#{ |
73
|
|
|
|
|
|
|
# my $self = shift; |
74
|
|
|
|
|
|
|
# my ($context, $attr) = @_; |
75
|
|
|
|
|
|
|
# |
76
|
|
|
|
|
|
|
# return $context->get($self, $attr); |
77
|
|
|
|
|
|
|
#} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
0
|
|
sub enter_scope { ($_[1])->enter_scope($_[0]) } |
80
|
|
|
|
|
|
|
#{ |
81
|
|
|
|
|
|
|
# my $self = shift; |
82
|
|
|
|
|
|
|
# my ($context) = @_; |
83
|
|
|
|
|
|
|
# |
84
|
|
|
|
|
|
|
# return $context->enter_scope($self); |
85
|
|
|
|
|
|
|
#} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
0
|
|
sub exit_scope { ($_[1])->exit_scope(@_[0, 2]) } |
88
|
|
|
|
|
|
|
#{ |
89
|
|
|
|
|
|
|
# my $self = shift; |
90
|
|
|
|
|
|
|
# my ($context, $no_delta) = @_; |
91
|
|
|
|
|
|
|
# |
92
|
|
|
|
|
|
|
# return $context->exit_scope($self, $no_delta); |
93
|
|
|
|
|
|
|
#} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub deltas |
96
|
|
|
|
|
|
|
{ |
97
|
|
|
|
|
|
|
# my $self = shift; |
98
|
|
|
|
|
|
|
# my ($context) = @_; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
0
|
0
|
|
return {}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
0
|
0
|
|
sub reset { $_[0]{__THIS_HAS_RENDERED__} = 0 } |
104
|
0
|
|
|
0
|
0
|
|
sub mark_as_rendered { $_[0]{__THIS_HAS_RENDERED__} = 1 } |
105
|
0
|
|
|
0
|
0
|
|
sub has_rendered { $_[0]{__THIS_HAS_RENDERED__} } |
106
|
0
|
0
|
|
0
|
0
|
|
sub should_render { ($_[0]{__THIS_HAS_RENDERED__}) || (($_[1])->should_render($_[0])) } |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub resolve |
109
|
|
|
|
|
|
|
{ |
110
|
|
|
|
|
|
|
# my $self = shift; |
111
|
|
|
|
|
|
|
# my ($context) = @_; |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
0
|
0
|
|
''; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub render |
117
|
|
|
|
|
|
|
{ |
118
|
|
|
|
|
|
|
# my $self = shift; |
119
|
|
|
|
|
|
|
# my ($context) = @_; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
0
|
0
|
|
return 1; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub begin_page |
125
|
|
|
|
|
|
|
{ |
126
|
|
|
|
|
|
|
# my $self = shift; |
127
|
|
|
|
|
|
|
# my ($context) = @_; |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
0
|
0
|
|
return 1; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub end_page |
133
|
|
|
|
|
|
|
{ |
134
|
|
|
|
|
|
|
# my $self = shift; |
135
|
|
|
|
|
|
|
# my ($context) = @_; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
0
|
0
|
|
return 1; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
__END__ |