← Index
NYTProf Performance Profile   « line view »
For rbm/rbm
  Run on Wed Feb 12 20:36:06 2020
Reported on Wed Feb 12 21:42:25 2020

Filename/usr/lib/x86_64-linux-gnu/perl5/5.28/Template/Base.pm
StatementsExecuted 21021688 statements in 30.3s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
26277097331.2s154sTemplate::Base::::newTemplate::Base::new (recurses: max depth 3, inclusive time 274s)
1111.44ms2.46msTemplate::Base::::BEGIN@24Template::Base::BEGIN@24
11110µs12µsTemplate::Base::::BEGIN@22Template::Base::BEGIN@22
1116µs16µsTemplate::Base::::BEGIN@137Template::Base::BEGIN@137
1116µs18µsTemplate::Base::::BEGIN@44Template::Base::BEGIN@44
1116µs30µsTemplate::Base::::BEGIN@45Template::Base::BEGIN@45
1116µs14µsTemplate::Base::::BEGIN@85Template::Base::BEGIN@85
1115µs17µsTemplate::Base::::BEGIN@23Template::Base::BEGIN@23
0000s0sTemplate::Base::::_initTemplate::Base::_init
0000s0sTemplate::Base::::debugTemplate::Base::debug
0000s0sTemplate::Base::::errorTemplate::Base::error
0000s0sTemplate::Base::::module_versionTemplate::Base::module_version
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::Base
4#
5# DESCRIPTION
6# Base class module implementing common functionality for various other
7# Template Toolkit modules.
8#
9# AUTHOR
10# Andy Wardley <abw@wardley.org>
11#
12# COPYRIGHT
13# Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.
14#
15# This module is free software; you can redistribute it and/or
16# modify it under the same terms as Perl itself.
17#
18#========================================================================
19
20package Template::Base;
21
22224µs214µs
# spent 12µs (10+2) within Template::Base::BEGIN@22 which was called: # once (10µs+2µs) by base::import at line 22
use strict;
# spent 12µs making 1 call to Template::Base::BEGIN@22 # spent 2µs making 1 call to strict::import
23217µs229µs
# spent 17µs (5+12) within Template::Base::BEGIN@23 which was called: # once (5µs+12µs) by base::import at line 23
use warnings;
# spent 17µs making 1 call to Template::Base::BEGIN@23 # spent 12µs making 1 call to warnings::import
242137µs22.47ms
# spent 2.46ms (1.44+1.02) within Template::Base::BEGIN@24 which was called: # once (1.44ms+1.02ms) by base::import at line 24
use Template::Constants;
# spent 2.46ms making 1 call to Template::Base::BEGIN@24 # spent 15µs making 1 call to Exporter::import
25
261300nsour $VERSION = 2.78;
27
28
29#------------------------------------------------------------------------
30# new(\%params)
31#
32# General purpose constructor method which expects a hash reference of
33# configuration parameters, or a list of name => value pairs which are
34# folded into a hash. Blesses a hash into an object and calls its
35# _init() method, passing the parameter hash reference. Returns a new
36# object derived from Template::Base, or undef on error.
37#------------------------------------------------------------------------
38
39
# spent 154s (31.2+122) within Template::Base::new which was called 2627709 times, avg 58µs/call: # 375387 times (6.25s+141s) by RBM::process_template at line 644 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 391µs/call # 375387 times (5.28s+1.47s) by Template::Parser::new at line 188 of Template/Parser.pm, avg 18µs/call # 375387 times (3.77s+-3.77s) by Template::Config::service at line 231 of Template/Config.pm, avg 0s/call # 375387 times (4.29s+-4.29s) by Template::Config::provider at line 121 of Template/Config.pm, avg 0s/call # 375387 times (3.92s+-3.92s) by Template::Config::filters at line 159 of Template/Config.pm, avg 0s/call # 375387 times (3.86s+-3.86s) by Template::Config::context at line 213 of Template/Config.pm, avg 0s/call # 375387 times (3.87s+-3.87s) by Template::Config::plugins at line 140 of Template/Config.pm, avg 0s/call
sub new {
402627709806ms my $class = shift;
412627709512ms my ($argnames, @args, $arg, $cfg);
42# $class->error(''); # always clear package $ERROR var?
43
442627711780ms230µs
# spent 18µs (6+12) within Template::Base::BEGIN@44 which was called: # once (6µs+12µs) by base::import at line 44
{ no strict 'refs';
# spent 18µs making 1 call to Template::Base::BEGIN@44 # spent 12µs making 1 call to strict::unimport
452155µs254µs
# spent 30µs (6+24) within Template::Base::BEGIN@45 which was called: # once (6µs+24µs) by base::import at line 45
no warnings 'once';
# spent 30µs making 1 call to Template::Base::BEGIN@45 # spent 24µs making 1 call to warnings::unimport
4626277094.56s $argnames = \@{"$class\::BASEARGS"} || [ ];
47 }
48
49 # shift off all mandatory args, returning error if undefined or null
5026277091.30s foreach $arg (@$argnames) {
51 return $class->error("no $arg specified")
52 unless ($cfg = shift);
53 push(@args, $cfg);
54 }
55
56 # fold all remaining args into a hash, or use provided hash ref
5726277092.73s $cfg = defined $_[0] && ref($_[0]) eq 'HASH' ? shift : { @_ };
58
59 my $self = bless {
6026277093.48s (map { ($_ => shift @args) } @$argnames),
61 _ERROR => '',
62 DEBUG => 0,
63 }, $class;
64
65262770916.1s2627709396s return $self->_init($cfg) ? $self : $class->error($self->error);
# spent 141s making 375387 calls to Template::_init, avg 375µs/call # spent 122s making 375387 calls to Template::Service::_init, avg 324µs/call # spent 101s making 375387 calls to Template::Context::_init, avg 270µs/call # spent 15.7s making 375387 calls to Template::Provider::_init, avg 42µs/call # spent 13.3s making 375387 calls to Template::Plugins::_init, avg 35µs/call # spent 2.23s making 375387 calls to Template::Filters::_init, avg 6µs/call # spent 1.47s making 375387 calls to Template::Directive::_init, avg 4µs/call
66}
67
68
69#------------------------------------------------------------------------
70# error()
71# error($msg, ...)
72#
73# May be called as a class or object method to set or retrieve the
74# package variable $ERROR (class method) or internal member
75# $self->{ _ERROR } (object method). The presence of parameters indicates
76# that the error value should be set. Undef is then returned. In the
77# absence of parameters, the current error value is returned.
78#------------------------------------------------------------------------
79
80sub error {
81 my $self = shift;
82 my $errvar;
83
84 {
852216µs221µs
# spent 14µs (6+8) within Template::Base::BEGIN@85 which was called: # once (6µs+8µs) by base::import at line 85
no strict qw( refs );
# spent 14µs making 1 call to Template::Base::BEGIN@85 # spent 8µs making 1 call to strict::unimport
86 $errvar = ref $self ? \$self->{ _ERROR } : \${"$self\::ERROR"};
87 }
88 if (@_) {
89 $$errvar = ref($_[0]) ? shift : join('', @_);
90 return undef;
91 }
92 else {
93 return $$errvar;
94 }
95}
96
97
98#------------------------------------------------------------------------
99# _init()
100#
101# Initialisation method called by the new() constructor and passing a
102# reference to a hash array containing any configuration items specified
103# as constructor arguments. Should return $self on success or undef on
104# error, via a call to the error() method to set the error message.
105#------------------------------------------------------------------------
106
107sub _init {
108 my ($self, $config) = @_;
109 return $self;
110}
111
112
113sub debug {
114 my $self = shift;
115 my $msg = join('', @_);
116 my ($pkg, $file, $line) = caller();
117
118 unless ($msg =~ /\n$/) {
119 $msg .= ($self->{ DEBUG } & Template::Constants::DEBUG_CALLER)
120 ? " at $file line $line\n"
121 : "\n";
122 }
123
124 print STDERR "[$pkg] $msg";
125}
126
127
128#------------------------------------------------------------------------
129# module_version()
130#
131# Returns the current version number.
132#------------------------------------------------------------------------
133
134sub module_version {
135 my $self = shift;
136 my $class = ref $self || $self;
137239µs226µs
# spent 16µs (6+10) within Template::Base::BEGIN@137 which was called: # once (6µs+10µs) by base::import at line 137
no strict 'refs';
# spent 16µs making 1 call to Template::Base::BEGIN@137 # spent 10µs making 1 call to strict::unimport
138 return ${"${class}::VERSION"};
139}
140
141
14213µs1;
143
144__END__