← Index
NYTProf Performance Profile   « line view »
For rbm/rbm
  Run on Wed Feb 12 03:38:15 2020
Reported on Wed Feb 12 04:56:35 2020

Filename/usr/lib/x86_64-linux-gnu/perl5/5.28/Template/Config.pm
StatementsExecuted 26873773 statements in 60.2s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
26873758118.0s21.6sTemplate::Config::::load Template::Config::load
383161116.05s151sTemplate::Config::::service Template::Config::service
383161115.56s30.3sTemplate::Config::::provider Template::Config::provider
383161115.47s12.4sTemplate::Config::::stash Template::Config::stash
383161115.30s125sTemplate::Config::::context Template::Config::context
383161115.09s14.6sTemplate::Config::::filters Template::Config::filters
383161114.99s60.8sTemplate::Config::::parser Template::Config::parser
383161114.87s27.3sTemplate::Config::::plugins Template::Config::plugins
2687375113.62s3.62sTemplate::Config::::CORE:subst Template::Config::CORE:subst (opcode)
52484197.1ms276msTemplate::Config::::iterator Template::Config::iterator
11114µs16µsTemplate::Config::::BEGIN@21 Template::Config::BEGIN@21
1116µs59µsTemplate::Config::::BEGIN@23 Template::Config::BEGIN@23
1116µs138µsTemplate::Config::::BEGIN@24 Template::Config::BEGIN@24
1115µs27µsTemplate::Config::::BEGIN@22 Template::Config::BEGIN@22
0000s0sTemplate::Config::::constants Template::Config::constants
0000s0sTemplate::Config::::instdir Template::Config::instdir
0000s0sTemplate::Config::::preload Template::Config::preload
0000s0sTemplate::TieString::::PRINTTemplate::TieString::PRINT
0000s0sTemplate::TieString::::TIEHANDLETemplate::TieString::TIEHANDLE
Call graph for these subroutines as a Graphviz dot language file.
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
19package Template::Config;
20
21220µs219µs
# spent 16µs (14+3) within Template::Config::BEGIN@21 which was called: # once (14µs+3µs) by Template::BEGIN@27 at line 21
use strict;
# spent 16µs making 1 call to Template::Config::BEGIN@21 # spent 3µs making 1 call to strict::import
22220µs248µs
# spent 27µs (5+21) within Template::Config::BEGIN@22 which was called: # once (5µs+21µs) by Template::BEGIN@27 at line 22
use warnings;
# spent 27µs making 1 call to Template::Config::BEGIN@22 # spent 21µs making 1 call to warnings::import
23239µs2112µs
# spent 59µs (6+53) within Template::Config::BEGIN@23 which was called: # once (6µs+53µs) by Template::BEGIN@27 at line 23
use base 'Template::Base';
# spent 59µs making 1 call to Template::Config::BEGIN@23 # spent 53µs making 1 call to base::import
2415µs1132µs
# spent 138µs (6+132) within Template::Config::BEGIN@24 which was called: # once (6µs+132µs) by Template::BEGIN@27 at line 27
use vars qw( $VERSION $DEBUG $ERROR $INSTDIR
# spent 132µs making 1 call to vars::import
25 $PARSER $PROVIDER $PLUGINS $FILTERS $ITERATOR
26 $LATEX_PATH $PDFLATEX_PATH $DVIPS_PATH
271857µs1138µs $STASH $SERVICE $CONTEXT $CONSTANTS @PRELOAD );
# spent 138µs making 1 call to Template::Config::BEGIN@24
28
291400ns$VERSION = 2.75;
301300ns$DEBUG = 0 unless defined $DEBUG;
311200ns$ERROR = '';
321200ns$CONTEXT = 'Template::Context';
331100ns$FILTERS = 'Template::Filters';
341100ns$ITERATOR = 'Template::Iterator';
351300ns$PARSER = 'Template::Parser';
361100ns$PLUGINS = 'Template::Plugins';
371100ns$PROVIDER = 'Template::Provider';
381100ns$SERVICE = 'Template::Service';
391200ns$STASH = 'Template::Stash::XS';
401100ns$CONSTANTS = 'Template::Namespace::Constants';
41
4211µs@PRELOAD = ( $CONTEXT, $FILTERS, $ITERATOR, $PARSER,
43 $PLUGINS, $PROVIDER, $SERVICE, $STASH );
44
45# the following is set at installation time by the Makefile.PL
461100ns$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
60sub 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 21.6s (18.0+3.65) within Template::Config::load which was called 2687375 times, avg 8µs/call: # 383161 times (4.33s+1.09s) by Template::Config::service at line 230, avg 14µs/call # 383161 times (2.46s+393ms) by Template::Config::context at line 212, avg 7µs/call # 383161 times (2.36s+402ms) by Template::Config::plugins at line 139, avg 7µs/call # 383161 times (2.23s+529ms) by Template::Config::parser at line 102, avg 7µs/call # 383161 times (2.17s+462ms) by Template::Config::stash at line 194, avg 7µs/call # 383161 times (2.21s+373ms) by Template::Config::provider at line 120, avg 7µs/call # 383161 times (2.15s+390ms) by Template::Config::filters at line 158, avg 7µs/call # 5248 times (56.0ms+16.6ms) by Template::Config::iterator at line 176, avg 14µs/call
sub load {
7926873751.23s my ($class, $module) = @_;
80268737514.3s26873753.62s $module =~ s[::][/]g;
# spent 3.62s making 2687375 calls to Template::Config::CORE:subst, avg 1µs/call
812687375498ms $module .= '.pm';
8253747503.16s eval { require $module; };
83268737511.0s 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 60.8s (4.99+55.8) within Template::Config::parser which was called 383161 times, avg 159µs/call: # 383161 times (4.99s+55.8s) by Template::Provider::_compile at line 838 of Template/Provider.pm, avg 159µs/call
sub parser {
98383161182ms my $class = shift;
99383161341ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
100 ? shift : { @_ };
101
102383161640ms3831612.76s return undef unless $class->load($PARSER);
# spent 2.76s making 383161 calls to Template::Config::load, avg 7µs/call
1033831612.99s38316153.1s return $PARSER->new($params)
# spent 53.1s making 383161 calls to Template::Parser::new, avg 139µ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 30.3s (5.56+24.8) within Template::Config::provider which was called 383161 times, avg 79µs/call: # 383161 times (5.56s+24.8s) by Template::Context::_init at line 851 of Template/Context.pm, avg 79µs/call
sub provider {
116383161176ms my $class = shift;
117383161542ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
118 ? shift : { @_ };
119
120383161673ms3831612.58s return undef unless $class->load($PROVIDER);
# spent 2.58s making 383161 calls to Template::Config::load, avg 7µs/call
1213831612.86s3831610s return $PROVIDER->new($params)
# spent 22.2s making 383161 calls to Template::Base::new, avg 58µs/call, recursion: max depth 3, sum of overlapping time 22.2s
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 27.3s (4.87+22.5) within Template::Config::plugins which was called 383161 times, avg 71µs/call: # 383161 times (4.87s+22.5s) by Template::Context::_init at line 851 of Template/Context.pm, avg 71µs/call
sub plugins {
135383161151ms my $class = shift;
136383161376ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
137 ? shift : { @_ };
138
139383161565ms3831612.76s return undef unless $class->load($PLUGINS);
# spent 2.76s making 383161 calls to Template::Config::load, avg 7µs/call
1403831612.64s3831610s return $PLUGINS->new($params)
# spent 19.7s making 383161 calls to Template::Base::new, avg 51µs/call, recursion: max depth 3, sum of overlapping time 19.7s
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 14.6s (5.09+9.50) within Template::Config::filters which was called 383161 times, avg 38µs/call: # 383161 times (5.09s+9.50s) by Template::Context::_init at line 851 of Template/Context.pm, avg 38µs/call
sub filters {
154383161180ms my $class = shift;
155383161433ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
156 ? shift : { @_ };
157
158383161583ms3831612.54s return undef unless $class->load($FILTERS);
# spent 2.54s making 383161 calls to Template::Config::load, avg 7µs/call
1593831612.81s3831610s return $FILTERS->new($params)
# spent 6.96s making 383161 calls to Template::Base::new, avg 18µs/call, recursion: max depth 3, sum of overlapping time 6.96s
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 276ms (97.1+179) within Template::Config::iterator which was called 5248 times, avg 53µs/call: # 1991 times (36.7ms+90.1ms) by Template::Document::__ANON__[input text:22] at line 11 of /root/tor-browser-build/input text, avg 64µs/call # 1991 times (36.4ms+46.0ms) by Template::Document::__ANON__[input text:43] at line 18 of /root/tor-browser-build/input text, avg 41µs/call # 993 times (20.0ms+34.7ms) by Template::Document::__ANON__[input text:35] at line 16 of /root/tor-browser-build/input text, avg 55µs/call # 273 times (4.03ms+8.00ms) by Template::Document::__ANON__[input text:35] at line 28 of /root/tor-browser-build/input text, avg 44µs/call
sub iterator {
17352484.17ms my $class = shift;
17452483.73ms my $list = shift;
175
176524815.6ms524872.6ms return undef unless $class->load($ITERATOR);
# spent 72.6ms making 5248 calls to Template::Config::load, avg 14µs/call
177524858.5ms5248106ms return $ITERATOR->new($list, @_)
# spent 106ms making 5248 calls to Template::Iterator::new, avg 20µ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 12.4s (5.47+6.97) within Template::Config::stash which was called 383161 times, avg 32µs/call: # 383161 times (5.47s+6.97s) by Template::Context::_init at line 877 of Template/Context.pm, avg 32µs/call
sub stash {
190383161229ms my $class = shift;
191383161376ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
192 ? shift : { @_ };
193
194383161586ms3831612.64s return undef unless $class->load($STASH);
# spent 2.64s making 383161 calls to Template::Config::load, avg 7µs/call
1953831613.30s3831614.33s return $STASH->new($params)
# spent 4.33s making 383161 calls to Template::Stash::new, avg 11µ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 125s (5.30+120) within Template::Config::context which was called 383161 times, avg 326µs/call: # 383161 times (5.30s+120s) by Template::Service::_init at line 177 of Template/Service.pm, avg 326µs/call
sub context {
208383161233ms my $class = shift;
209383161594ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
210 ? shift : { @_ };
211
212383161606ms3831612.85s return undef unless $class->load($CONTEXT);
# spent 2.85s making 383161 calls to Template::Config::load, avg 7µs/call
2133831612.66s3831610s return $CONTEXT->new($params)
# spent 117s making 383161 calls to Template::Base::new, avg 305µs/call, recursion: max depth 2, sum of overlapping time 117s
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 151s (6.05+145) within Template::Config::service which was called 383161 times, avg 394µs/call: # 383161 times (6.05s+145s) by Template::_init at line 142 of Template.pm, avg 394µs/call
sub service {
226383161185ms my $class = shift;
227383161645ms my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
228 ? shift : { @_ };
229
2303831611.37s3831615.41s return undef unless $class->load($SERVICE);
# spent 5.41s making 383161 calls to Template::Config::load, avg 14µs/call
2313831612.93s3831610s return $SERVICE->new($params)
# spent 139s making 383161 calls to Template::Base::new, avg 364µs/call, recursion: max depth 1, sum of overlapping time 139s
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
244sub 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
263sub 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
285package Template::TieString;
286
287sub TIEHANDLE {
288 my ($class, $textref) = @_;
289 bless $textref, $class;
290}
291sub PRINT {
292 my $self = shift;
293 $$self .= join('', @_);
294}
295
- -
29817µs1;
299
300__END__
 
# spent 3.62s within Template::Config::CORE:subst which was called 2687375 times, avg 1µs/call: # 2687375 times (3.62s+0s) by Template::Config::load at line 80, avg 1µs/call
sub Template::Config::CORE:subst; # opcode