| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PDF::Template::Factory; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
38
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
307
|
BEGIN { |
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw(%Manifest %isBuildable); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
%Manifest = ( |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# These are the instantiable nodes |
|
12
|
|
|
|
|
|
|
'ALWAYS' => 'PDF::Template::Container::Always', |
|
13
|
|
|
|
|
|
|
'CONDITIONAL' => 'PDF::Template::Container::Conditional', |
|
14
|
|
|
|
|
|
|
'FONT' => 'PDF::Template::Container::Font', |
|
15
|
|
|
|
|
|
|
'IF' => 'PDF::Template::Container::Conditional', |
|
16
|
|
|
|
|
|
|
'LOOP' => 'PDF::Template::Container::Loop', |
|
17
|
|
|
|
|
|
|
'PAGEDEF' => 'PDF::Template::Container::PageDef', |
|
18
|
|
|
|
|
|
|
'PDFTEMPLATE' => 'PDF::Template::Container::PdfTemplate', |
|
19
|
|
|
|
|
|
|
'ROW' => 'PDF::Template::Container::Row', |
|
20
|
|
|
|
|
|
|
'SCOPE' => 'PDF::Template::Container::Scope', |
|
21
|
|
|
|
|
|
|
'SECTION' => 'PDF::Template::Container::Section', |
|
22
|
|
|
|
|
|
|
'HEADER' => 'PDF::Template::Container::Header', |
|
23
|
|
|
|
|
|
|
'FOOTER' => 'PDF::Template::Container::Footer', |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
'BOOKMARK' => 'PDF::Template::Element::Bookmark', |
|
26
|
|
|
|
|
|
|
'CIRCLE' => 'PDF::Template::Element::Circle', |
|
27
|
|
|
|
|
|
|
'HR' => 'PDF::Template::Element::HorizontalRule', |
|
28
|
|
|
|
|
|
|
'IMAGE' => 'PDF::Template::Element::Image', |
|
29
|
|
|
|
|
|
|
'PAGEBREAK' => 'PDF::Template::Element::PageBreak', |
|
30
|
|
|
|
|
|
|
'LINE' => 'PDF::Template::Element::Line', |
|
31
|
|
|
|
|
|
|
'TEXTBOX' => 'PDF::Template::Element::TextBox', |
|
32
|
|
|
|
|
|
|
'VAR' => 'PDF::Template::Element::Var', |
|
33
|
|
|
|
|
|
|
'WEBLINK' => 'PDF::Template::Element::Weblink', |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# These are the helper objects |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
'TEXTOBJECT' => 'PDF::Template::TextObject', |
|
38
|
|
|
|
|
|
|
'CONTEXT' => 'PDF::Template::Context', |
|
39
|
|
|
|
|
|
|
'ITERATOR' => 'PDF::Template::Iterator', |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
'MARGIN' => 'PDF::Template::Container::Margin', |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
'CONTAINER' => 'PDF::Template::Container', |
|
44
|
|
|
|
|
|
|
'ELEMENT' => 'PDF::Template::Element', |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
'BASE' => 'PDF::Template::Base', |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
%isBuildable = map { $_ => 1 } qw( |
|
50
|
|
|
|
|
|
|
ALWAYS |
|
51
|
|
|
|
|
|
|
BOOKMARK |
|
52
|
|
|
|
|
|
|
CIRCLE |
|
53
|
|
|
|
|
|
|
CONDITIONAL |
|
54
|
|
|
|
|
|
|
FONT |
|
55
|
|
|
|
|
|
|
FOOTER |
|
56
|
|
|
|
|
|
|
HEADER |
|
57
|
|
|
|
|
|
|
HR |
|
58
|
|
|
|
|
|
|
IF |
|
59
|
|
|
|
|
|
|
IMAGE |
|
60
|
|
|
|
|
|
|
LINE |
|
61
|
|
|
|
|
|
|
LOOP |
|
62
|
|
|
|
|
|
|
PAGEBREAK |
|
63
|
|
|
|
|
|
|
PAGEDEF |
|
64
|
|
|
|
|
|
|
PDFTEMPLATE |
|
65
|
|
|
|
|
|
|
ROW |
|
66
|
|
|
|
|
|
|
SCOPE |
|
67
|
|
|
|
|
|
|
SECTION |
|
68
|
|
|
|
|
|
|
TEXTBOX |
|
69
|
|
|
|
|
|
|
VAR |
|
70
|
|
|
|
|
|
|
WEBLINK |
|
71
|
|
|
|
|
|
|
); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub register |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
0
|
|
|
0
|
0
|
0
|
my %params = @_; |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
0
|
my @param_names = qw(name class isa); |
|
78
|
0
|
|
|
|
|
0
|
for (@param_names) |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
0
|
0
|
|
|
|
0
|
unless ($params{$_}) |
|
81
|
|
|
|
|
|
|
{ |
|
82
|
0
|
|
|
|
|
0
|
warn "$_ was not supplied to register()\n"; |
|
83
|
0
|
|
|
|
|
0
|
return 0; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
0
|
my $name = uc $params{name}; |
|
88
|
0
|
0
|
|
|
|
0
|
if (exists $Manifest{$name}) |
|
89
|
|
|
|
|
|
|
{ |
|
90
|
0
|
|
|
|
|
0
|
warn "$params{name} already exists in the manifest.\n"; |
|
91
|
0
|
|
|
|
|
0
|
return 0; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
0
|
my $isa = uc $params{isa}; |
|
95
|
0
|
0
|
|
|
|
0
|
unless (exists $Manifest{$isa}) |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
|
|
|
|
0
|
warn "$params{isa} does not exist in the manifest.\n"; |
|
98
|
0
|
|
|
|
|
0
|
return 0; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
0
|
$Manifest{$name} = $params{class}; |
|
102
|
0
|
|
|
|
|
0
|
$isBuildable{$name} = 1; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
{ |
|
105
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
515
|
|
|
|
0
|
|
|
|
|
0
|
|
|
106
|
0
|
|
|
|
|
0
|
unshift @{"$params{class}::ISA"}, $Manifest{$isa}; |
|
|
0
|
|
|
|
|
0
|
|
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
0
|
return 1; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub create |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
|
115
|
0
|
|
|
|
|
0
|
my $name = uc shift; |
|
116
|
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
0
|
return unless exists $Manifest{$name}; |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
0
|
(my $filename = $Manifest{$name}) =~ s!::!/!g; |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
eval { |
|
122
|
0
|
|
|
|
|
0
|
require "$filename.pm"; |
|
123
|
0
|
0
|
|
|
|
0
|
}; if ($@) { |
|
124
|
0
|
|
|
|
|
0
|
die "Cannot find or compile PM file for '$name' ($filename)\n"; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
0
|
return $Manifest{$name}->new(@_); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub create_node |
|
131
|
|
|
|
|
|
|
{ |
|
132
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
|
133
|
0
|
|
|
|
|
0
|
my $name = uc shift; |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
0
|
return unless exists $isBuildable{$name}; |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
0
|
return $class->create($name, @_); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub isa |
|
141
|
|
|
|
|
|
|
{ |
|
142
|
1
|
50
|
33
|
1
|
0
|
10
|
return UNIVERSAL::isa($_[0], $Manifest{uc $_[1]}) |
|
143
|
|
|
|
|
|
|
if @_ >= 2 && exists $Manifest{uc $_[1]}; |
|
144
|
|
|
|
|
|
|
|
|
145
|
1
|
|
|
|
|
7
|
UNIVERSAL::isa(@_) |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |
|
149
|
|
|
|
|
|
|
__END__ |