← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 14:31:06 2016
Reported on Fri Jan 8 14:33:27 2016

Filename/usr/lib/x86_64-linux-gnu/perl5/5.20/Template/Config.pm
StatementsExecuted 80 statements in 431µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
298113.4ms43.6msTemplate::Config::::load Template::Config::load
41184µs10.5msTemplate::Config::::stash Template::Config::stash
291178µs78µsTemplate::Config::::CORE:subst Template::Config::CORE:subst (opcode)
41165µs310µsTemplate::Config::::provider Template::Config::provider
41163µs20.4msTemplate::Config::::service Template::Config::service
41161µs23.9msTemplate::Config::::parser Template::Config::parser
41159µs20.1msTemplate::Config::::context Template::Config::context
41159µs1.64msTemplate::Config::::plugins Template::Config::plugins
41154µs3.57msTemplate::Config::::filters Template::Config::filters
11123µs1.57msTemplate::Config::::iterator Template::Config::iterator
11116µs24µsTemplate::Config::::BEGIN@21 Template::Config::BEGIN@21
11110µs52µsTemplate::Config::::BEGIN@23 Template::Config::BEGIN@23
11110µs113µsTemplate::Config::::BEGIN@24 Template::Config::BEGIN@24
1118µs15µ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
21233µs
# spent 24µs (16+9) within Template::Config::BEGIN@21 which was called: # once (16µs+9µs) by Template::BEGIN@27 at line 21
use strict;
# spent 24µs making 1 call to Template::Config::BEGIN@21 # spent 9µs making 1 call to strict::import
22223µs
# spent 15µs (8+7) within Template::Config::BEGIN@22 which was called: # once (8µs+7µs) by Template::BEGIN@27 at line 22
use warnings;
# spent 15µs making 1 call to Template::Config::BEGIN@22 # spent 7µs making 1 call to warnings::import
23293µs
# spent 52µs (10+42) within Template::Config::BEGIN@23 which was called: # once (10µs+42µs) by Template::BEGIN@27 at line 23
use base 'Template::Base';
# spent 52µs making 1 call to Template::Config::BEGIN@23 # spent 42µs making 1 call to base::import
241103µs
# spent 113µs (10+103) within Template::Config::BEGIN@24 which was called: # once (10µs+103µs) by Template::BEGIN@27 at line 27
use vars qw( $VERSION $DEBUG $ERROR $INSTDIR
# spent 103µs making 1 call to vars::import
25 $PARSER $PROVIDER $PLUGINS $FILTERS $ITERATOR
26 $LATEX_PATH $PDFLATEX_PATH $DVIPS_PATH
271113µs $STASH $SERVICE $CONTEXT $CONSTANTS @PRELOAD );
# spent 113µs making 1 call to Template::Config::BEGIN@24
28
29$VERSION = 2.75;
30$DEBUG = 0 unless defined $DEBUG;
31$ERROR = '';
32$CONTEXT = 'Template::Context';
33$FILTERS = 'Template::Filters';
34$ITERATOR = 'Template::Iterator';
35$PARSER = 'Template::Parser';
36$PLUGINS = 'Template::Plugins';
37$PROVIDER = 'Template::Provider';
38$SERVICE = 'Template::Service';
39$STASH = 'Template::Stash::XS';
40$CONSTANTS = 'Template::Namespace::Constants';
41
42@PRELOAD = ( $CONTEXT, $FILTERS, $ITERATOR, $PARSER,
43 $PLUGINS, $PROVIDER, $SERVICE, $STASH );
44
45# the following is set at installation time by the Makefile.PL
46$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 occurences 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 43.6ms (13.4+30.2) within Template::Config::load which was called 29 times, avg 1.50ms/call: # 4 times (3.92ms+19.4ms) by Template::Config::parser at line 102, avg 5.82ms/call # 4 times (519µs+9.68ms) by Template::Config::stash at line 194, avg 2.55ms/call # 4 times (3.42ms+294µs) by Template::Config::context at line 212, avg 929µs/call # 4 times (2.98ms+463µs) by Template::Config::filters at line 158, avg 861µs/call # 4 times (1.22ms+137µs) by Template::Config::plugins at line 139, avg 340µs/call # 4 times (43µs+19µs) by Template::Config::service at line 230, avg 15µs/call # 4 times (21µs+9µs) by Template::Config::provider at line 120, avg 8µs/call # once (1.26ms+282µs) by Template::Config::iterator at line 176
sub load {
7984µs my ($class, $module) = @_;
80842µs2978µs $module =~ s[::][/]g;
# spent 78µs making 29 calls to Template::Config::CORE:subst, avg 3µs/call
8182µs $module .= '.pm';
8216235µs eval { require $module; };
83838µs 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 23.9ms (61µs+23.8) within Template::Config::parser which was called 4 times, avg 5.96ms/call: # 4 times (61µs+23.8ms) by Template::Provider::_compile at line 838 of Template/Provider.pm, avg 5.96ms/call
sub parser {
9811µs my $class = shift;
9912µs my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
100 ? shift : { @_ };
101
10212µs423.3ms return undef unless $class->load($PARSER);
# spent 23.3ms making 4 calls to Template::Config::load, avg 5.82ms/call
103111µs4523µs return $PARSER->new($params)
# spent 523µs making 4 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 310µs (65+246) within Template::Config::provider which was called 4 times, avg 78µs/call: # 4 times (65µs+246µs) by Template::Context::_init at line 851 of Template/Context.pm, avg 78µs/call
sub provider {
11611µs my $class = shift;
11712µs my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
118 ? shift : { @_ };
119
12011µs430µs return undef unless $class->load($PROVIDER);
# spent 30µs making 4 calls to Template::Config::load, avg 8µs/call
121110µs40s return $PROVIDER->new($params)
# spent 216µs making 4 calls to Template::Base::new, avg 54µs/call, recursion: max depth 3, sum of overlapping time 216µs
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 1.64ms (59µs+1.58) within Template::Config::plugins which was called 4 times, avg 410µs/call: # 4 times (59µs+1.58ms) by Template::Context::_init at line 851 of Template/Context.pm, avg 410µs/call
sub plugins {
1351500ns my $class = shift;
13612µs my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
137 ? shift : { @_ };
138
13911µs41.36ms return undef unless $class->load($PLUGINS);
# spent 1.36ms making 4 calls to Template::Config::load, avg 340µs/call
14018µs40s return $PLUGINS->new($params)
# spent 219µs making 4 calls to Template::Base::new, avg 55µs/call, recursion: max depth 3, sum of overlapping time 219µs
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 3.57ms (54µs+3.52) within Template::Config::filters which was called 4 times, avg 893µs/call: # 4 times (54µs+3.52ms) by Template::Context::_init at line 851 of Template/Context.pm, avg 893µs/call
sub filters {
1541500ns my $class = shift;
15511µs my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
156 ? shift : { @_ };
157
15811µs43.44ms return undef unless $class->load($FILTERS);
# spent 3.44ms making 4 calls to Template::Config::load, avg 861µs/call
15915µs40s return $FILTERS->new($params)
# spent 76µs making 4 calls to Template::Base::new, avg 19µs/call, recursion: max depth 3, sum of overlapping time 76µs
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 1.57ms (23µs+1.55) within Template::Config::iterator which was called: # once (23µs+1.55ms) by Template::Document::__ANON__[/home/vagrant/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt:203] at line 193 of koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
sub iterator {
1731700ns my $class = shift;
1741200ns my $list = shift;
175
17612µs11.54ms return undef unless $class->load($ITERATOR);
# spent 1.54ms making 1 call to Template::Config::load
177113µs112µs return $ITERATOR->new($list, @_)
# spent 12µs making 1 call to Template::Iterator::new
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 10.5ms (84µs+10.4) within Template::Config::stash which was called 4 times, avg 2.62ms/call: # 4 times (84µs+10.4ms) by Template::Context::_init at line 877 of Template/Context.pm, avg 2.62ms/call
sub stash {
19011µs my $class = shift;
1911800ns my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
192 ? shift : { @_ };
193
19411µs410.2ms return undef unless $class->load($STASH);
# spent 10.2ms making 4 calls to Template::Config::load, avg 2.55ms/call
195113µs4195µs return $STASH->new($params)
# spent 195µs making 4 calls to Template::Stash::new, avg 49µ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 20.1ms (59µs+20.1) within Template::Config::context which was called 4 times, avg 5.03ms/call: # 4 times (59µs+20.1ms) by Template::Service::_init at line 177 of Template/Service.pm, avg 5.03ms/call
sub context {
20811µs my $class = shift;
20911µs my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
210 ? shift : { @_ };
211
21211µs43.72ms return undef unless $class->load($CONTEXT);
# spent 3.72ms making 4 calls to Template::Config::load, avg 929µs/call
21319µs40s return $CONTEXT->new($params)
# spent 16.3ms making 4 calls to Template::Base::new, avg 4.09ms/call, recursion: max depth 2, sum of overlapping time 16.3ms
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 20.4ms (63µs+20.4) within Template::Config::service which was called 4 times, avg 5.11ms/call: # 4 times (63µs+20.4ms) by Template::_init at line 142 of Template.pm, avg 5.11ms/call
sub service {
22611µs my $class = shift;
22711µs my $params = defined($_[0]) && ref($_[0]) eq 'HASH'
228 ? shift : { @_ };
229
23014µs462µs return undef unless $class->load($SERVICE);
# spent 62µs making 4 calls to Template::Config::load, avg 15µs/call
23118µs40s return $SERVICE->new($params)
# spent 20.3ms making 4 calls to Template::Base::new, avg 5.07ms/call, recursion: max depth 1, sum of overlapping time 20.3ms
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
- -
2981;
299
300__END__
 
# spent 78µs within Template::Config::CORE:subst which was called 29 times, avg 3µs/call: # 29 times (78µs+0s) by Template::Config::load at line 80, avg 3µs/call
sub Template::Config::CORE:subst; # opcode