← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 11:58:52 2013
Reported on Tue Oct 15 12:01:12 2013

Filename/usr/share/koha/lib/C4/Boolean.pm
StatementsExecuted 19 statements in 930µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.83ms2.08msC4::Boolean::::BEGIN@28C4::Boolean::BEGIN@28
1111.50ms2.19msC4::Boolean::::BEGIN@55C4::Boolean::BEGIN@55
11138µs47µsC4::Boolean::::BEGIN@24C4::Boolean::BEGIN@24
11127µs63µsC4::Boolean::::BEGIN@25C4::Boolean::BEGIN@25
11120µs100µsC4::Boolean::::BEGIN@27C4::Boolean::BEGIN@27
0000s0sC4::Boolean::::true_pC4::Boolean::true_p
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::Boolean;
2
3#package to handle Boolean values in the parameters table
4# Note: This is just a utility module; it should not be instantiated.
5
6
7# Copyright 2003 Katipo Communications
8#
9# This file is part of Koha.
10#
11# Koha is free software; you can redistribute it and/or modify it under the
12# terms of the GNU General Public License as published by the Free Software
13# Foundation; either version 2 of the License, or (at your option) any later
14# version.
15#
16# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License along
21# with Koha; if not, write to the Free Software Foundation, Inc.,
22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24356µs255µs
# spent 47µs (38+8) within C4::Boolean::BEGIN@24 which was called: # once (38µs+8µs) by C4::Context::BEGIN@104 at line 24
use strict;
# spent 47µs making 1 call to C4::Boolean::BEGIN@24 # spent 8µs making 1 call to strict::import
25355µs298µs
# spent 63µs (27+35) within C4::Boolean::BEGIN@25 which was called: # once (27µs+35µs) by C4::Context::BEGIN@104 at line 25
use warnings;
# spent 63µs making 1 call to C4::Boolean::BEGIN@25 # spent 35µs making 1 call to warnings::import
26
27359µs2179µs
# spent 100µs (20+79) within C4::Boolean::BEGIN@27 which was called: # once (20µs+79µs) by C4::Context::BEGIN@104 at line 27
use Carp;
# spent 100µs making 1 call to C4::Boolean::BEGIN@27 # spent 79µs making 1 call to Exporter::import
283275µs22.20ms
# spent 2.08ms (1.83+249µs) within C4::Boolean::BEGIN@28 which was called: # once (1.83ms+249µs) by C4::Context::BEGIN@104 at line 28
use base qw(Exporter);
# spent 2.08ms making 1 call to C4::Boolean::BEGIN@28 # spent 118µs making 1 call to base::import
29
3013µsour $VERSION = 3.07.00.049;
3113µsour @EXPORT_OK = qw( true_p);
32
33=head1 NAME
34
- -
551180µs
# spent 2.19ms (1.50+684µs) within C4::Boolean::BEGIN@55 which was called: # once (1.50ms+684µs) by C4::Context::BEGIN@104 at line 56
use constant INVALID_BOOLEAN_STRING_EXCEPTION =>
# spent 180µs making 1 call to constant::import
563456µs12.19ms q{The given value does not seem to be interpretable as a Boolean value};
# spent 2.19ms making 1 call to C4::Boolean::BEGIN@55
57
58112µsour %strings = (
59 '0' => 0, '1' => 1, # C
60 '-1' => 1, # BASIC
61 'nil' => 0, 't' => 1, # LISP
62 'false' => 0, 'true' => 1, # Pascal
63 'off' => 0, 'on' => 1,
64 'no' => 0, 'yes' => 1,
65 'n' => 0, 'y' => 1,
66);
67
68=item true_p
69
- -
80sub true_p {
81 my $x = shift;
82 my $it;
83 if (!defined $x || ref $x ) {
84 carp INVALID_BOOLEAN_STRING_EXCEPTION;
85 return;
86 }
87 $x = lc $x;
88 $x =~ s/\s//g;
89 if (defined $strings{$x}) {
90 $it = $strings{$x};
91 } else {
92 carp INVALID_BOOLEAN_STRING_EXCEPTION;
93 }
94 return $it;
95}
96
97113µs1;
98__END__