← 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:31:35 2016

Filename/home/vagrant/kohaclone/C4/Templates.pm
StatementsExecuted 1167 statements in 5.48ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.43ms18.7msC4::Templates::::BEGIN@33C4::Templates::BEGIN@33
211932µs932µsC4::Templates::::CORE:ftisC4::Templates::CORE:ftis (opcode)
105303417µs417µsC4::Templates::::paramC4::Templates::param
111218µs167msC4::Templates::::outputC4::Templates::output
221120µs39.8msC4::Templates::::themelanguageC4::Templates::themelanguage
111108µs96.3msC4::Templates::::gettemplateC4::Templates::gettemplate
111100µs33.8msC4::Templates::::newC4::Templates::new
11128µs42µsC4::Templates::::BEGIN@3C4::Templates::BEGIN@3
11126µs23.5msC4::Templates::::_get_template_fileC4::Templates::_get_template_file
11117µs84µsC4::Templates::::BEGIN@35C4::Templates::BEGIN@35
11117µs112µsC4::Templates::::BEGIN@32C4::Templates::BEGIN@32
11116µs26µsC4::Templates::::BEGIN@4C4::Templates::BEGIN@4
11115µs47µsC4::Templates::::BEGIN@7C4::Templates::BEGIN@7
11114µs45µsC4::Templates::::BEGIN@6C4::Templates::BEGIN@6
11113µs207µsC4::Templates::::BEGIN@34C4::Templates::BEGIN@34
11113µs16µsC4::Templates::::BEGIN@37C4::Templates::BEGIN@37
11111µs68µsC4::Templates::::BEGIN@5C4::Templates::BEGIN@5
11110µs10µsC4::Templates::::CORE:binmodeC4::Templates::CORE:binmode (opcode)
2113µs3µsC4::Templates::::CORE:matchC4::Templates::CORE:match (opcode)
0000s0sC4::Templates::::GetColumnDefsC4::Templates::GetColumnDefs
0000s0sC4::Templates::::getlanguagecookieC4::Templates::getlanguagecookie
0000s0sC4::Templates::::setlanguagecookieC4::Templates::setlanguagecookie
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::Templates;
2
3254µs255µs
# spent 42µs (28+13) within C4::Templates::BEGIN@3 which was called: # once (28µs+13µs) by C4::Output::BEGIN@34 at line 3
use strict;
# spent 42µs making 1 call to C4::Templates::BEGIN@3 # spent 13µs making 1 call to strict::import
4244µs237µs
# spent 26µs (16+11) within C4::Templates::BEGIN@4 which was called: # once (16µs+11µs) by C4::Output::BEGIN@34 at line 4
use warnings;
# spent 26µs making 1 call to C4::Templates::BEGIN@4 # spent 11µs making 1 call to warnings::import
5298µs2125µs
# spent 68µs (11+57) within C4::Templates::BEGIN@5 which was called: # once (11µs+57µs) by C4::Output::BEGIN@34 at line 5
use Carp;
# spent 68µs making 1 call to C4::Templates::BEGIN@5 # spent 57µs making 1 call to Exporter::import
6279µs277µs
# spent 45µs (14+32) within C4::Templates::BEGIN@6 which was called: # once (14µs+32µs) by C4::Output::BEGIN@34 at line 6
use CGI qw ( -utf8 );
# spent 45µs making 1 call to C4::Templates::BEGIN@6 # spent 32µs making 1 call to CGI::import
7290µs279µs
# spent 47µs (15+32) within C4::Templates::BEGIN@7 which was called: # once (15µs+32µs) by C4::Output::BEGIN@34 at line 7
use List::MoreUtils qw/ any uniq /;
# spent 47µs making 1 call to C4::Templates::BEGIN@7 # spent 32µs making 1 call to Exporter::import
8
9# Copyright 2009 Chris Cormack and The Koha Dev Team
10#
11# This file is part of Koha.
12#
13# Koha is free software; you can redistribute it and/or modify it
14# under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 3 of the License, or
16# (at your option) any later version.
17#
18# Koha is distributed in the hope that it will be useful, but
19# WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with Koha; if not, see <http://www.gnu.org/licenses>.
25
26=head1 NAME
27
28 Koha::Templates - Object for manipulating templates for use with Koha
29
30=cut
31
322148µs2208µs
# spent 112µs (17+95) within C4::Templates::BEGIN@32 which was called: # once (17µs+95µs) by C4::Output::BEGIN@34 at line 32
use base qw(Class::Accessor);
# spent 112µs making 1 call to C4::Templates::BEGIN@32 # spent 95µs making 1 call to base::import
332237µs118.7ms
# spent 18.7ms (1.43+17.3) within C4::Templates::BEGIN@33 which was called: # once (1.43ms+17.3ms) by C4::Output::BEGIN@34 at line 33
use Template;
# spent 18.7ms making 1 call to C4::Templates::BEGIN@33
342237µs2400µs
# spent 207µs (13+194) within C4::Templates::BEGIN@34 which was called: # once (13µs+194µs) by C4::Output::BEGIN@34 at line 34
use Template::Constants qw( :debug );
# spent 207µs making 1 call to C4::Templates::BEGIN@34 # spent 194µs making 1 call to Exporter::import
352107µs2150µs
# spent 84µs (17+66) within C4::Templates::BEGIN@35 which was called: # once (17µs+66µs) by C4::Output::BEGIN@34 at line 35
use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language_get_description accept_language );
# spent 84µs making 1 call to C4::Templates::BEGIN@35 # spent 66µs making 1 call to Exporter::import
36
3721.60ms220µs
# spent 16µs (13+4) within C4::Templates::BEGIN@37 which was called: # once (13µs+4µs) by C4::Output::BEGIN@34 at line 37
use C4::Context;
# spent 16µs making 1 call to C4::Templates::BEGIN@37 # spent 4µs making 1 call to C4::Context::import
38
391222µs1208µs__PACKAGE__->mk_accessors(qw( theme activethemes preferredtheme lang filename htdocs interface vars));
# spent 208µs making 1 call to Class::Accessor::mk_accessors
40
- -
43
# spent 33.8ms (100µs+33.7) within C4::Templates::new which was called: # once (100µs+33.7ms) by C4::Templates::gettemplate at line 178
sub new {
441700ns my $class = shift;
451400ns my $interface = shift;
461300ns my $filename = shift;
471400ns my $tmplbase = shift;
4811µs my $query = @_? shift: undef;
491300ns my $htdocs;
5011µs if ( $interface ne "intranet" ) {
51 $htdocs = C4::Context->config('opachtdocs');
52 }
53 else {
54113µs16µs $htdocs = C4::Context->config('intrahtdocs');
# spent 6µs making 1 call to C4::Context::config
55 }
5614µs116.3ms my ($theme, $lang, $activethemes)= themelanguage( $htdocs, $tmplbase, $interface, $query);
# spent 16.3ms making 1 call to C4::Templates::themelanguage
571400ns my @includes;
5812µs foreach (@$activethemes) {
5936µs push @includes, "$htdocs/$_/$lang/includes";
6031µs push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en';
61 }
62 # Do not use template cache if script is called from commandline
63112µs16µs my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
# spent 6µs making 1 call to C4::Context::config
64121µs117.4ms my $template = Template->new(
# spent 17.4ms making 1 call to Template::Base::new
65 { EVAL_PERL => 1,
66 ABSOLUTE => 1,
67 PLUGIN_BASE => 'Koha::Template::Plugin',
68 COMPILE_EXT => $use_template_cache ? '.ttc' : '',
69 COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '',
70 INCLUDE_PATH => \@includes,
71 FILTERS => {},
72 ENCODING => 'UTF-8',
73 }
74 ) or die Template->error();
7512µs my $self = {
76 TEMPLATE => $template,
77 VARS => {},
78 };
7914µs bless $self, $class;
80125µs118µs $self->theme($theme);
# spent 18µs making 1 call to C4::Templates::theme
8118µs14µs $self->lang($lang);
# spent 4µs making 1 call to C4::Templates::lang
8218µs13µs $self->activethemes($activethemes);
# spent 3µs making 1 call to C4::Templates::activethemes
8317µs13µs $self->preferredtheme($activethemes->[0]);
# spent 3µs making 1 call to C4::Templates::preferredtheme
8418µs14µs $self->filename($filename);
# spent 4µs making 1 call to C4::Templates::filename
8518µs14µs $self->htdocs($htdocs);
# spent 4µs making 1 call to C4::Templates::htdocs
8616µs13µs $self->interface($interface);
# spent 3µs making 1 call to C4::Templates::interface
8712µs $self->{VARS}->{"test"} = "value";
8815µs return $self;
89
90}
91
92
# spent 167ms (218µs+167) within C4::Templates::output which was called: # once (218µs+167ms) by CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::__ANON__[/home/vagrant/kohaclone/mainpage.pl:107] at line 87 of mainpage.pl
sub output {
931400ns my $self = shift;
941300ns my $vars = shift;
95
96# my $file = $self->htdocs . '/' . $self->theme .'/'.$self->lang.'/'.$self->filename;
971800ns my $template = $self->{TEMPLATE};
98114µs110µs if ( $self->interface eq 'intranet' ) {
# spent 10µs making 1 call to C4::Templates::interface
99 $vars->{themelang} = '/intranet-tmpl';
100 }
101 else {
102 $vars->{themelang} = '/opac-tmpl';
103 }
10417µs13µs $vars->{lang} = $self->lang;
# spent 3µs making 1 call to C4::Templates::lang
105111µs24µs $vars->{themelang} .= '/' . $self->preferredtheme . '/' . $self->lang;
# spent 3µs making 1 call to C4::Templates::preferredtheme # spent 1µs making 1 call to C4::Templates::lang
10612µs $vars->{interface} =
107 ( $self->{interface} ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' );
10817µs13µs $vars->{theme} = $self->theme;
# spent 3µs making 1 call to C4::Templates::theme
109114µs12.41ms $vars->{OpacAdditionalStylesheet} =
# spent 2.41ms making 1 call to C4::Context::preference
110 C4::Context->preference('OpacAdditionalStylesheet');
111110µs12.07ms $vars->{opaclayoutstylesheet} =
# spent 2.07ms making 1 call to C4::Context::preference
112 C4::Context->preference('opaclayoutstylesheet');
113
114 # add variables set via param to $vars for processing
115141µs for my $k ( keys %{ $self->{VARS} } ) {
11616098µs $vars->{$k} = $self->{VARS}->{$k};
117 }
118
1191200ns my $data;
120116µs110µs binmode( STDOUT, ":utf8" );
# spent 10µs making 1 call to C4::Templates::CORE:binmode
121116µs2163ms $template->process( $self->filename, $vars, \$data )
# spent 163ms making 1 call to Template::process # spent 7µs making 1 call to C4::Templates::filename
122 || die "Template process failed: ", $template->error();
123126µs return $data;
124}
125
126# wrapper method to allow easier transition from HTML template pro to Template Toolkit
127
# spent 417µs within C4::Templates::param which was called 105 times, avg 4µs/call: # 76 times (195µs+0s) by C4::Auth::get_template_and_user at line 282 of C4/Auth.pm, avg 3µs/call # once (58µs+0s) by C4::Auth::get_template_and_user at line 433 of C4/Auth.pm # once (42µs+0s) by C4::Auth::get_template_and_user at line 409 of C4/Auth.pm # once (17µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::__ANON__[/home/vagrant/kohaclone/mainpage.pl:107] at line 72 of mainpage.pl # once (14µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::__ANON__[/home/vagrant/kohaclone/mainpage.pl:107] at line 53 of mainpage.pl # once (10µs+0s) by C4::Auth::get_template_and_user at line 228 of C4/Auth.pm # once (9µs+0s) by C4::Auth::get_template_and_user at line 396 of C4/Auth.pm # once (8µs+0s) by C4::Templates::gettemplate at line 197 # once (5µs+0s) by C4::Auth::get_template_and_user at line 400 of C4/Auth.pm # once (5µs+0s) by C4::Auth::get_template_and_user at line 262 of C4/Auth.pm # once (4µs+0s) by C4::Auth::get_template_and_user at line 251 of C4/Auth.pm # once (4µs+0s) by C4::Auth::get_template_and_user at line 263 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 269 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 265 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 304 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 273 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 271 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 229 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 268 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 278 of C4/Auth.pm # once (3µs+0s) by C4::Auth::get_template_and_user at line 230 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 275 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 266 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 270 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 276 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 264 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 272 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 277 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 274 of C4/Auth.pm # once (2µs+0s) by C4::Auth::get_template_and_user at line 267 of C4/Auth.pm
sub param {
12810517µs my $self = shift;
129105197µs while (@_) {
13016029µs my $key = shift;
13116021µs my $val = shift;
13216042µs if ( ref($val) eq 'ARRAY' && !scalar @$val ) { $val = undef; }
133 elsif ( ref($val) eq 'HASH' && !scalar %$val ) { $val = undef; }
134160208µs if ( $key ) {
135 $self->{VARS}->{$key} = $val;
136 } else {
137 warn "Problem = a value of $val has been passed to param without key";
138 }
139 }
140}
141
142
143=head1 NAME
144
145C4::Templates - Functions for managing templates
146
147=head1 FUNCTIONS
148
149=cut
150
151# FIXME: this is a quick fix to stop rc1 installing broken
152# Still trying to figure out the correct fix.
153122µs116µsmy $path = C4::Context->config('intrahtdocs') . "/prog/en/includes/";
# spent 16µs making 1 call to C4::Context::config
154
155#---------------------------------------------------------------------------------------------------------
156# FIXME - POD
157
158
# spent 23.5ms (26µs+23.5) within C4::Templates::_get_template_file which was called: # once (26µs+23.5ms) by C4::Templates::gettemplate at line 175
sub _get_template_file {
15911µs my ($tmplbase, $interface, $query) = @_;
160
1611800ns my $is_intranet = $interface eq 'intranet';
162112µs16µs my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs');
# spent 6µs making 1 call to C4::Context::config
16316µs123.5ms my ($theme, $lang, $availablethemes) = themelanguage($htdocs, $tmplbase, $interface, $query);
# spent 23.5ms making 1 call to C4::Templates::themelanguage
1641300ns $lang //= 'en';
16514µs my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
166
16715µs return ($htdocs, $theme, $lang, $filename);
168}
169
170
171
# spent 96.3ms (108µs+96.2) within C4::Templates::gettemplate which was called: # once (108µs+96.2ms) by C4::Auth::get_template_and_user at line 166 of C4/Auth.pm
sub gettemplate {
17212µs my ( $tmplbase, $interface, $query, $is_plugin ) = @_;
17311µs ($query) or warn "no query in gettemplate";
174123µs13.54ms my $path = C4::Context->preference('intranet_includes') || 'includes';
# spent 3.54ms making 1 call to C4::Context::preference
17514µs123.5ms my ($htdocs, $theme, $lang, $filename)
# spent 23.5ms making 1 call to C4::Templates::_get_template_file
176 = _get_template_file($tmplbase, $interface, $query);
1771400ns $filename = $tmplbase if ( $is_plugin );
17819µs133.8ms my $template = C4::Templates->new($interface, $filename, $tmplbase, $query);
# spent 33.8ms making 1 call to C4::Templates::new
179
180# NOTE: Commenting these out rather than deleting them so that those who need
181# to know how we previously shimmed these directories will be able to understand.
182# my $is_intranet = $interface eq 'intranet';
183# my $themelang =
184# ($is_intranet ? '/intranet-tmpl' : '/opac-tmpl') .
185# "/$theme/$lang";
186# $template->param(
187# themelang => $themelang,
188# interface => $is_intranet ? '/intranet-tmpl' : '/opac-tmpl',
189# theme => $theme,
190# lang => $lang
191# );
192
193 # Bidirectionality, must be sent even if is the only language
1941344µs1336µs my $current_lang = regex_lang_subtags($lang);
# spent 336µs making 1 call to C4::Languages::regex_lang_subtags
1951300ns my $bidi;
1961900ns $bidi = get_bidi($current_lang->{script}) if $current_lang->{script};
19713µs18µs $template->param(
# spent 8µs making 1 call to C4::Templates::param
198 bidi => $bidi,
199 );
200 # Languages
201123µs135.0ms my $languages_loop = getTranslatedLanguages($interface,$theme,$lang);
# spent 35.0ms making 1 call to C4::Languages::getTranslatedLanguages
2021500ns my $num_languages_enabled = 0;
20312µs foreach my $lang (@$languages_loop) {
2041912µs foreach my $sublang (@{ $lang->{'sublanguages_loop'} }) {
2052111µs $num_languages_enabled++ if $sublang->{enabled};
206 }
207 }
2081900ns my $one_language_enabled = ($num_languages_enabled <= 1) ? 1 : 0; # deal with zero enabled langs as well
2091300ns $template->param(
210 languages_loop => $languages_loop,
211 one_language_enabled => $one_language_enabled,
212 ) unless $one_language_enabled;
213
214135µs return $template;
215}
216
217
218=head2 themelanguage
219
220 my ($theme,$lang,\@themes) = themelanguage($htdocs,$tmpl,$interface,query);
221
222This function returns the theme and language to be used for rendering the UI.
223It also returns the list of themes that should be applied as a fallback. This is
224used for the theme overlay feature (i.e. if a file doesn't exist on the requested
225theme, fallback to the configured fallback).
226
227Important: this function is used on the webinstaller too, so always consider
228the use case where the DB is not populated already when rewriting/fixing.
229
230=cut
231
232
# spent 39.8ms (120µs+39.6) within C4::Templates::themelanguage which was called 2 times, avg 19.9ms/call: # once (76µs+23.4ms) by C4::Templates::_get_template_file at line 163 # once (44µs+16.3ms) by C4::Templates::new at line 56
sub themelanguage {
23321µs my ($htdocs, $tmpl, $interface, $query) = @_;
23421µs ($query) or warn "no query in themelanguage";
235
236 # Select a language based on cookie, syspref available languages & browser
237246µs212.2ms my $lang = C4::Languages::getlanguage($query);
# spent 12.2ms making 2 calls to C4::Languages::getlanguage, avg 6.12ms/call
238
239 # Get theme
2402300ns my @themes;
24122µs my $theme_syspref = ($interface eq 'intranet') ? 'template' : 'opacthemes';
2422900ns my $fallback_syspref = ($interface eq 'intranet') ? 'template' : 'OPACFallback';
243 # Yeah, hardcoded, last resort if the DB is not populated
24421µs my $hardcoded_theme = ($interface eq 'intranet') ? 'prog' : 'bootstrap';
245
246 # Configured theme is the first one
247225µs49.16ms push @themes, C4::Context->preference( $theme_syspref )
# spent 9.16ms making 4 calls to C4::Context::preference, avg 2.29ms/call
248 if C4::Context->preference( $theme_syspref );
249 # Configured fallback next
250218µs417.3ms push @themes, C4::Context->preference( $fallback_syspref )
# spent 17.3ms making 4 calls to C4::Context::preference, avg 4.33ms/call
251 if C4::Context->preference( $fallback_syspref );
252 # The hardcoded fallback theme is the last one
25321µs push @themes, $hardcoded_theme;
254
255 # Try to find first theme for the selected theme/lang, then for fallback/lang
256213µs23µs my $where = $tmpl =~ /xsl$/ ? 'xslt' : 'modules';
# spent 3µs making 2 calls to C4::Templates::CORE:match, avg 2µs/call
25721µs for my $theme (@themes) {
2582999µs4951µs if ( -e "$htdocs/$theme/$lang/$where/$tmpl" ) {
# spent 932µs making 2 calls to C4::Templates::CORE:ftis, avg 466µs/call # spent 19µs making 2 calls to List::MoreUtils::uniq, avg 10µs/call
259 return ( $theme, $lang, uniq( \@themes ) );
260 }
261 }
262 # Otherwise return theme/'en', last resort fallback/'en'
263 for my $theme (@themes) {
264 if ( -e "$htdocs/$theme/en/$where/$tmpl" ) {
265 return ( $theme, 'en', uniq( \@themes ) );
266 }
267 }
268 # tmpl is a full path, so this is a template for a plugin
269 if ( $tmpl =~ /^\// && -e $tmpl ) {
270 return ( $themes[0], $lang, uniq( \@themes ) );
271 }
272}
273
274
275sub setlanguagecookie {
276 my ( $query, $language, $uri ) = @_;
277
278 my $cookie = $query->cookie(
279 -name => 'KohaOpacLanguage',
280 -value => $language,
281 -HttpOnly => 1,
282 -expires => '+3y'
283 );
284 print $query->redirect(
285 -uri => $uri,
286 -cookie => $cookie
287 );
288}
289
290=head2 getlanguagecookie
291
292 my $cookie = getlanguagecookie($query,$language);
293
294Returns a cookie object containing the calculated language to be used.
295
296=cut
297
298sub getlanguagecookie {
299 my ( $query, $language ) = @_;
300 my $cookie = $query->cookie(
301 -name => 'KohaOpacLanguage',
302 -value => $language,
303 -HttpOnly => 1,
304 -expires => '+3y'
305 );
306
307 return $cookie;
308}
309
310=head2 GetColumnDefs
311
312 my $columns = GetColumnDefs( $cgi )
313
314It is passed a CGI object and returns a hash of hashes containing
315the column names and descriptions for each table defined in the
316columns.def file corresponding to the CGI object.
317
318=cut
319
320sub GetColumnDefs {
321
322 my $query = shift;
323
324 my $columns = {};
325
326 my $htdocs = C4::Context->config('intrahtdocs');
327 my $columns_file = 'columns.def';
328
329 # Get theme and language to build the path to columns.def
330 my ($theme, $lang, $availablethemes) =
331 themelanguage($htdocs, 'about.tt', 'intranet', $query);
332 # Build columns.def path
333 my $path = "$htdocs/$theme/$lang/$columns_file";
334 my $fh;
335 if ( ! open ( $fh, q{<:encoding(utf-8)}, $path ) ) {
336 carp "Error opening $path. Check your templates.";
337 return;
338 }
339 # Loop through the columns.def file
340 while ( my $input = <$fh> ){
341 chomp $input;
342 if ( $input =~ m|<field name="(.*)">(.*)</field>| ) {
343 my ( $table, $column ) = split( '\.', $1);
344 my $description = $2;
345 # Initialize the table array if needed.
346 @{$columns->{ $table }} = () if ! defined $columns->{ $table };
347 # Push field and description
348 push @{$columns->{ $table }},
349 { field => $column, description => $description };
350 }
351 }
352 close $fh;
353
354 return $columns;
355}
356
35715µs1;
 
# spent 10µs within C4::Templates::CORE:binmode which was called: # once (10µs+0s) by C4::Templates::output at line 120
sub C4::Templates::CORE:binmode; # opcode
# spent 932µs within C4::Templates::CORE:ftis which was called 2 times, avg 466µs/call: # 2 times (932µs+0s) by C4::Templates::themelanguage at line 258, avg 466µs/call
sub C4::Templates::CORE:ftis; # opcode
# spent 3µs within C4::Templates::CORE:match which was called 2 times, avg 2µs/call: # 2 times (3µs+0s) by C4::Templates::themelanguage at line 256, avg 2µs/call
sub C4::Templates::CORE:match; # opcode