Filename | /usr/lib/x86_64-linux-gnu/perl5/5.28/Template/Config.pm |
Statements | Executed 26329593 statements in 55.0s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
2632957 | 8 | 1 | 17.0s | 20.7s | load | Template::Config::
375387 | 1 | 1 | 5.25s | 57.2s | parser | Template::Config::
375387 | 1 | 1 | 5.10s | 11.5s | stash | Template::Config::
375387 | 1 | 1 | 5.07s | 135s | service | Template::Config::
375387 | 1 | 1 | 4.79s | 27.2s | provider | Template::Config::
375387 | 1 | 1 | 4.58s | 13.2s | filters | Template::Config::
375387 | 1 | 1 | 4.55s | 112s | context | Template::Config::
375387 | 1 | 1 | 4.43s | 24.4s | plugins | Template::Config::
2632957 | 1 | 1 | 3.71s | 3.71s | CORE:subst (opcode) | Template::Config::
5248 | 4 | 1 | 132ms | 321ms | iterator | Template::Config::
1 | 1 | 1 | 9µs | 11µs | BEGIN@21 | Template::Config::
1 | 1 | 1 | 5µs | 127µs | BEGIN@24 | Template::Config::
1 | 1 | 1 | 5µs | 122µs | BEGIN@23 | Template::Config::
1 | 1 | 1 | 4µs | 20µs | BEGIN@22 | Template::Config::
0 | 0 | 0 | 0s | 0s | constants | Template::Config::
0 | 0 | 0 | 0s | 0s | instdir | Template::Config::
0 | 0 | 0 | 0s | 0s | preload | Template::Config::
0 | 0 | 0 | 0s | 0s | |
0 | 0 | 0 | 0s | 0s | TIEHANDLE | Template::TieString::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | #============================================================= -*-perl-*- | ||||
2 | # | ||||
3 | # Template::Config | ||||
4 | # | ||||
5 | # DESCRIPTION | ||||
6 | # Template Toolkit configuration module. | ||||
7 | # | ||||
8 | # AUTHOR | ||||
9 | # Andy Wardley <abw@wardley.org> | ||||
10 | # | ||||
11 | # COPYRIGHT | ||||
12 | # Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved. | ||||
13 | # | ||||
14 | # This module is free software; you can redistribute it and/or | ||||
15 | # modify it under the same terms as Perl itself. | ||||
16 | # | ||||
17 | #======================================================================== | ||||
18 | |||||
19 | package Template::Config; | ||||
20 | |||||
21 | 2 | 18µs | 2 | 13µs | # spent 11µs (9+2) within Template::Config::BEGIN@21 which was called:
# once (9µs+2µs) by Template::BEGIN@27 at line 21 # spent 11µs making 1 call to Template::Config::BEGIN@21
# spent 2µs making 1 call to strict::import |
22 | 2 | 18µs | 2 | 36µs | # spent 20µs (4+16) within Template::Config::BEGIN@22 which was called:
# once (4µs+16µs) by Template::BEGIN@27 at line 22 # spent 20µs making 1 call to Template::Config::BEGIN@22
# spent 16µs making 1 call to warnings::import |
23 | 2 | 38µs | 2 | 239µs | # spent 122µs (5+117) within Template::Config::BEGIN@23 which was called:
# once (5µs+117µs) by Template::BEGIN@27 at line 23 # spent 122µs making 1 call to Template::Config::BEGIN@23
# spent 117µs making 1 call to base::import |
24 | 1 | 3µs | 1 | 122µs | # spent 127µs (5+122) within Template::Config::BEGIN@24 which was called:
# once (5µs+122µs) by Template::BEGIN@27 at line 27 # spent 122µs making 1 call to vars::import |
25 | $PARSER $PROVIDER $PLUGINS $FILTERS $ITERATOR | ||||
26 | $LATEX_PATH $PDFLATEX_PATH $DVIPS_PATH | ||||
27 | 1 | 897µs | 1 | 127µs | $STASH $SERVICE $CONTEXT $CONSTANTS @PRELOAD ); # spent 127µs making 1 call to Template::Config::BEGIN@24 |
28 | |||||
29 | 1 | 300ns | $VERSION = 2.75; | ||
30 | 1 | 300ns | $DEBUG = 0 unless defined $DEBUG; | ||
31 | 1 | 300ns | $ERROR = ''; | ||
32 | 1 | 100ns | $CONTEXT = 'Template::Context'; | ||
33 | 1 | 200ns | $FILTERS = 'Template::Filters'; | ||
34 | 1 | 100ns | $ITERATOR = 'Template::Iterator'; | ||
35 | 1 | 100ns | $PARSER = 'Template::Parser'; | ||
36 | 1 | 100ns | $PLUGINS = 'Template::Plugins'; | ||
37 | 1 | 100ns | $PROVIDER = 'Template::Provider'; | ||
38 | 1 | 100ns | $SERVICE = 'Template::Service'; | ||
39 | 1 | 100ns | $STASH = 'Template::Stash::XS'; | ||
40 | 1 | 200ns | $CONSTANTS = 'Template::Namespace::Constants'; | ||
41 | |||||
42 | 1 | 1µs | @PRELOAD = ( $CONTEXT, $FILTERS, $ITERATOR, $PARSER, | ||
43 | $PLUGINS, $PROVIDER, $SERVICE, $STASH ); | ||||
44 | |||||
45 | # the following is set at installation time by the Makefile.PL | ||||
46 | 1 | 200ns | $INSTDIR = ''; | ||
47 | |||||
48 | |||||
49 | #======================================================================== | ||||
50 | # --- CLASS METHODS --- | ||||
51 | #======================================================================== | ||||
52 | |||||
53 | #------------------------------------------------------------------------ | ||||
54 | # preload($module, $module, ...) | ||||
55 | # | ||||
56 | # Preloads all the standard TT modules that are likely to be used, along | ||||
57 | # with any other passed as arguments. | ||||
58 | #------------------------------------------------------------------------ | ||||
59 | |||||
60 | sub preload { | ||||
61 | my $class = shift; | ||||
62 | |||||
63 | foreach my $module (@PRELOAD, @_) { | ||||
64 | $class->load($module) || return; | ||||
65 | }; | ||||
66 | return 1; | ||||
67 | } | ||||
68 | |||||
69 | |||||
70 | #------------------------------------------------------------------------ | ||||
71 | # load($module) | ||||
72 | # | ||||
73 | # Load a module via require(). Any occurrences of '::' in the module name | ||||
74 | # are be converted to '/' and '.pm' is appended. Returns 1 on success | ||||
75 | # or undef on error. Use $class->error() to examine the error string. | ||||
76 | #------------------------------------------------------------------------ | ||||
77 | |||||
78 | # spent 20.7s (17.0+3.74) within Template::Config::load which was called 2632957 times, avg 8µs/call:
# 375387 times (3.67s+1.08s) by Template::Config::service at line 230, avg 13µs/call
# 375387 times (2.41s+426ms) by Template::Config::plugins at line 139, avg 8µs/call
# 375387 times (2.36s+409ms) by Template::Config::context at line 212, avg 7µs/call
# 375387 times (2.19s+561ms) by Template::Config::parser at line 102, avg 7µs/call
# 375387 times (2.10s+472ms) by Template::Config::stash at line 194, avg 7µs/call
# 375387 times (2.10s+408ms) by Template::Config::filters at line 158, avg 7µs/call
# 375387 times (2.08s+369ms) by Template::Config::provider at line 120, avg 7µs/call
# 5248 times (57.2ms+15.1ms) by Template::Config::iterator at line 176, avg 14µs/call | ||||
79 | 2632957 | 1.04s | my ($class, $module) = @_; | ||
80 | 2632957 | 13.8s | 2632957 | 3.71s | $module =~ s[::][/]g; # spent 3.71s making 2632957 calls to Template::Config::CORE:subst, avg 1µs/call |
81 | 2632957 | 486ms | $module .= '.pm'; | ||
82 | 5265914 | 3.12s | eval { require $module; }; | ||
83 | 2632957 | 10.5s | return $@ ? $class->error("failed to load $module: $@") : 1; | ||
84 | } | ||||
85 | |||||
86 | |||||
87 | #------------------------------------------------------------------------ | ||||
88 | # parser(\%params) | ||||
89 | # | ||||
90 | # Instantiate a new parser object of the class whose name is denoted by | ||||
91 | # the package variable $PARSER (default: Template::Parser). Returns | ||||
92 | # a reference to a newly instantiated parser object or undef on error. | ||||
93 | # The class error() method can be called without arguments to examine | ||||
94 | # the error message generated by this failure. | ||||
95 | #------------------------------------------------------------------------ | ||||
96 | |||||
97 | # spent 57.2s (5.25+51.9) within Template::Config::parser which was called 375387 times, avg 152µs/call:
# 375387 times (5.25s+51.9s) by Template::Provider::_compile at line 838 of Template/Provider.pm, avg 152µs/call | ||||
98 | 375387 | 188ms | my $class = shift; | ||
99 | 375387 | 397ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
100 | ? shift : { @_ }; | ||||
101 | |||||
102 | 375387 | 569ms | 375387 | 2.75s | return undef unless $class->load($PARSER); # spent 2.75s making 375387 calls to Template::Config::load, avg 7µs/call |
103 | 375387 | 2.86s | 375387 | 49.2s | return $PARSER->new($params) # spent 49.2s making 375387 calls to Template::Parser::new, avg 131µs/call |
104 | || $class->error("failed to create parser: ", $PARSER->error); | ||||
105 | } | ||||
106 | |||||
107 | |||||
108 | #------------------------------------------------------------------------ | ||||
109 | # provider(\%params) | ||||
110 | # | ||||
111 | # Instantiate a new template provider object (default: Template::Provider). | ||||
112 | # Returns an object reference or undef on error, as above. | ||||
113 | #------------------------------------------------------------------------ | ||||
114 | |||||
115 | # spent 27.2s (4.79+22.4) within Template::Config::provider which was called 375387 times, avg 73µs/call:
# 375387 times (4.79s+22.4s) by Template::Context::_init at line 851 of Template/Context.pm, avg 73µs/call | ||||
116 | 375387 | 149ms | my $class = shift; | ||
117 | 375387 | 311ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
118 | ? shift : { @_ }; | ||||
119 | |||||
120 | 375387 | 522ms | 375387 | 2.45s | return undef unless $class->load($PROVIDER); # spent 2.45s making 375387 calls to Template::Config::load, avg 7µs/call |
121 | 375387 | 2.53s | 375387 | 0s | return $PROVIDER->new($params) # spent 20.0s making 375387 calls to Template::Base::new, avg 53µs/call, recursion: max depth 3, sum of overlapping time 20.0s |
122 | || $class->error("failed to create template provider: ", | ||||
123 | $PROVIDER->error); | ||||
124 | } | ||||
125 | |||||
126 | |||||
127 | #------------------------------------------------------------------------ | ||||
128 | # plugins(\%params) | ||||
129 | # | ||||
130 | # Instantiate a new plugins provider object (default: Template::Plugins). | ||||
131 | # Returns an object reference or undef on error, as above. | ||||
132 | #------------------------------------------------------------------------ | ||||
133 | |||||
134 | # spent 24.4s (4.43+20.0) within Template::Config::plugins which was called 375387 times, avg 65µs/call:
# 375387 times (4.43s+20.0s) by Template::Context::_init at line 851 of Template/Context.pm, avg 65µs/call | ||||
135 | 375387 | 232ms | my $class = shift; | ||
136 | 375387 | 330ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
137 | ? shift : { @_ }; | ||||
138 | |||||
139 | 375387 | 499ms | 375387 | 2.84s | return undef unless $class->load($PLUGINS); # spent 2.84s making 375387 calls to Template::Config::load, avg 8µs/call |
140 | 375387 | 2.24s | 375387 | 0s | return $PLUGINS->new($params) # spent 17.1s making 375387 calls to Template::Base::new, avg 46µs/call, recursion: max depth 3, sum of overlapping time 17.1s |
141 | || $class->error("failed to create plugin provider: ", | ||||
142 | $PLUGINS->error); | ||||
143 | } | ||||
144 | |||||
145 | |||||
146 | #------------------------------------------------------------------------ | ||||
147 | # filters(\%params) | ||||
148 | # | ||||
149 | # Instantiate a new filters provider object (default: Template::Filters). | ||||
150 | # Returns an object reference or undef on error, as above. | ||||
151 | #------------------------------------------------------------------------ | ||||
152 | |||||
153 | # spent 13.2s (4.58+8.66) within Template::Config::filters which was called 375387 times, avg 35µs/call:
# 375387 times (4.58s+8.66s) by Template::Context::_init at line 851 of Template/Context.pm, avg 35µs/call | ||||
154 | 375387 | 267ms | my $class = shift; | ||
155 | 375387 | 534ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
156 | ? shift : { @_ }; | ||||
157 | |||||
158 | 375387 | 495ms | 375387 | 2.51s | return undef unless $class->load($FILTERS); # spent 2.51s making 375387 calls to Template::Config::load, avg 7µs/call |
159 | 375387 | 2.40s | 375387 | 0s | return $FILTERS->new($params) # spent 6.15s making 375387 calls to Template::Base::new, avg 16µs/call, recursion: max depth 3, sum of overlapping time 6.15s |
160 | || $class->error("failed to create filter provider: ", | ||||
161 | $FILTERS->error); | ||||
162 | } | ||||
163 | |||||
164 | |||||
165 | #------------------------------------------------------------------------ | ||||
166 | # iterator(\@list) | ||||
167 | # | ||||
168 | # Instantiate a new Template::Iterator object (default: Template::Iterator). | ||||
169 | # Returns an object reference or undef on error, as above. | ||||
170 | #------------------------------------------------------------------------ | ||||
171 | |||||
172 | # spent 321ms (132+189) within Template::Config::iterator which was called 5248 times, avg 61µs/call:
# 1991 times (58.5ms+81.4ms) by Template::Document::__ANON__[input text:22] at line 11 of /root/tor-browser-build/input text, avg 70µs/call
# 1991 times (53.3ms+51.1ms) by Template::Document::__ANON__[input text:43] at line 18 of /root/tor-browser-build/input text, avg 52µs/call
# 993 times (16.1ms+48.9ms) by Template::Document::__ANON__[input text:35] at line 16 of /root/tor-browser-build/input text, avg 65µs/call
# 273 times (4.33ms+7.18ms) by Template::Document::__ANON__[input text:35] at line 28 of /root/tor-browser-build/input text, avg 42µs/call | ||||
173 | 5248 | 1.88ms | my $class = shift; | ||
174 | 5248 | 2.34ms | my $list = shift; | ||
175 | |||||
176 | 5248 | 14.0ms | 5248 | 72.3ms | return undef unless $class->load($ITERATOR); # spent 72.3ms making 5248 calls to Template::Config::load, avg 14µs/call |
177 | 5248 | 70.0ms | 5248 | 116ms | return $ITERATOR->new($list, @_) # spent 116ms making 5248 calls to Template::Iterator::new, avg 22µs/call |
178 | || $class->error("failed to create iterator: ", $ITERATOR->error); | ||||
179 | } | ||||
180 | |||||
181 | |||||
182 | #------------------------------------------------------------------------ | ||||
183 | # stash(\%vars) | ||||
184 | # | ||||
185 | # Instantiate a new template variable stash object (default: | ||||
186 | # Template::Stash). Returns object or undef, as above. | ||||
187 | #------------------------------------------------------------------------ | ||||
188 | |||||
189 | # spent 11.5s (5.10+6.37) within Template::Config::stash which was called 375387 times, avg 31µs/call:
# 375387 times (5.10s+6.37s) by Template::Context::_init at line 877 of Template/Context.pm, avg 31µs/call | ||||
190 | 375387 | 132ms | my $class = shift; | ||
191 | 375387 | 322ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
192 | ? shift : { @_ }; | ||||
193 | |||||
194 | 375387 | 498ms | 375387 | 2.57s | return undef unless $class->load($STASH); # spent 2.57s making 375387 calls to Template::Config::load, avg 7µs/call |
195 | 375387 | 2.76s | 375387 | 3.80s | return $STASH->new($params) # spent 3.80s making 375387 calls to Template::Stash::new, avg 10µs/call |
196 | || $class->error("failed to create stash: ", $STASH->error); | ||||
197 | } | ||||
198 | |||||
199 | |||||
200 | #------------------------------------------------------------------------ | ||||
201 | # context(\%params) | ||||
202 | # | ||||
203 | # Instantiate a new template context object (default: Template::Context). | ||||
204 | # Returns object or undef, as above. | ||||
205 | #------------------------------------------------------------------------ | ||||
206 | |||||
207 | # spent 112s (4.55+108) within Template::Config::context which was called 375387 times, avg 299µs/call:
# 375387 times (4.55s+108s) by Template::Service::_init at line 177 of Template/Service.pm, avg 299µs/call | ||||
208 | 375387 | 191ms | my $class = shift; | ||
209 | 375387 | 403ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
210 | ? shift : { @_ }; | ||||
211 | |||||
212 | 375387 | 558ms | 375387 | 2.77s | return undef unless $class->load($CONTEXT); # spent 2.77s making 375387 calls to Template::Config::load, avg 7µs/call |
213 | 375387 | 2.27s | 375387 | 0s | return $CONTEXT->new($params) # spent 105s making 375387 calls to Template::Base::new, avg 280µs/call, recursion: max depth 2, sum of overlapping time 105s |
214 | || $class->error("failed to create context: ", $CONTEXT->error); | ||||
215 | } | ||||
216 | |||||
217 | |||||
218 | #------------------------------------------------------------------------ | ||||
219 | # service(\%params) | ||||
220 | # | ||||
221 | # Instantiate a new template context object (default: Template::Service). | ||||
222 | # Returns object or undef, as above. | ||||
223 | #------------------------------------------------------------------------ | ||||
224 | |||||
225 | # spent 135s (5.07+130) within Template::Config::service which was called 375387 times, avg 360µs/call:
# 375387 times (5.07s+130s) by Template::_init at line 142 of Template.pm, avg 360µs/call | ||||
226 | 375387 | 209ms | my $class = shift; | ||
227 | 375387 | 540ms | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||
228 | ? shift : { @_ }; | ||||
229 | |||||
230 | 375387 | 1.04s | 375387 | 4.75s | return undef unless $class->load($SERVICE); # spent 4.75s making 375387 calls to Template::Config::load, avg 13µs/call |
231 | 375387 | 2.47s | 375387 | 0s | return $SERVICE->new($params) # spent 125s making 375387 calls to Template::Base::new, avg 334µs/call, recursion: max depth 1, sum of overlapping time 125s |
232 | || $class->error("failed to create context: ", $SERVICE->error); | ||||
233 | } | ||||
234 | |||||
235 | |||||
236 | #------------------------------------------------------------------------ | ||||
237 | # constants(\%params) | ||||
238 | # | ||||
239 | # Instantiate a new namespace handler for compile time constant folding | ||||
240 | # (default: Template::Namespace::Constants). | ||||
241 | # Returns object or undef, as above. | ||||
242 | #------------------------------------------------------------------------ | ||||
243 | |||||
244 | sub constants { | ||||
245 | my $class = shift; | ||||
246 | my $params = defined($_[0]) && ref($_[0]) eq 'HASH' | ||||
247 | ? shift : { @_ }; | ||||
248 | |||||
249 | return undef unless $class->load($CONSTANTS); | ||||
250 | return $CONSTANTS->new($params) | ||||
251 | || $class->error("failed to create constants namespace: ", | ||||
252 | $CONSTANTS->error); | ||||
253 | } | ||||
254 | |||||
255 | |||||
256 | #------------------------------------------------------------------------ | ||||
257 | # instdir($dir) | ||||
258 | # | ||||
259 | # Returns the root installation directory appended with any local | ||||
260 | # component directory passed as an argument. | ||||
261 | #------------------------------------------------------------------------ | ||||
262 | |||||
263 | sub instdir { | ||||
264 | my ($class, $dir) = @_; | ||||
265 | my $inst = $INSTDIR | ||||
266 | || return $class->error("no installation directory"); | ||||
267 | $inst =~ s[/$][]g; | ||||
268 | $inst .= "/$dir" if $dir; | ||||
269 | return $inst; | ||||
270 | } | ||||
271 | |||||
272 | |||||
273 | #======================================================================== | ||||
274 | # This should probably be moved somewhere else in the long term, but for | ||||
275 | # now it ensures that Template::TieString is available even if the | ||||
276 | # Template::Directive module hasn't been loaded, as is the case when | ||||
277 | # using compiled templates and Template::Parser hasn't yet been loaded | ||||
278 | # on demand. | ||||
279 | #======================================================================== | ||||
280 | |||||
281 | #------------------------------------------------------------------------ | ||||
282 | # simple package for tying $output variable to STDOUT, used by perl() | ||||
283 | #------------------------------------------------------------------------ | ||||
284 | |||||
285 | package Template::TieString; | ||||
286 | |||||
287 | sub TIEHANDLE { | ||||
288 | my ($class, $textref) = @_; | ||||
289 | bless $textref, $class; | ||||
290 | } | ||||
291 | sub PRINT { | ||||
292 | my $self = shift; | ||||
293 | $$self .= join('', @_); | ||||
294 | } | ||||
295 | |||||
- - | |||||
298 | 1 | 7µs | 1; | ||
299 | |||||
300 | __END__ | ||||
# spent 3.71s within Template::Config::CORE:subst which was called 2632957 times, avg 1µs/call:
# 2632957 times (3.71s+0s) by Template::Config::load at line 80, avg 1µs/call |