← 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:13 2013

Filename/usr/share/perl5/DateTime/TimeZone/Local.pm
StatementsExecuted 19 statements in 1.52ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11129µs39µsDateTime::TimeZone::Local::::BEGIN@3DateTime::TimeZone::Local::BEGIN@3
11119µs56µsDateTime::TimeZone::Local::::BEGIN@4DateTime::TimeZone::Local::BEGIN@4
11118µs18µsDateTime::TimeZone::Local::::BEGIN@10DateTime::TimeZone::Local::BEGIN@10
11116µs81µsDateTime::TimeZone::Local::::BEGIN@6DateTime::TimeZone::Local::BEGIN@6
11111µs11µsDateTime::TimeZone::Local::::BEGIN@9DateTime::TimeZone::Local::BEGIN@9
0000s0sDateTime::TimeZone::Local::::FromEnvDateTime::TimeZone::Local::FromEnv
0000s0sDateTime::TimeZone::Local::::TimeZoneDateTime::TimeZone::Local::TimeZone
0000s0sDateTime::TimeZone::Local::::_IsValidNameDateTime::TimeZone::Local::_IsValidName
0000s0sDateTime::TimeZone::Local::::_load_subclassDateTime::TimeZone::Local::_load_subclass
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DateTime::TimeZone::Local;
2
3353µs248µs
# spent 39µs (29+9) within DateTime::TimeZone::Local::BEGIN@3 which was called: # once (29µs+9µs) by DateTime::TimeZone::BEGIN@12 at line 3
use strict;
# spent 39µs making 1 call to DateTime::TimeZone::Local::BEGIN@3 # spent 9µs making 1 call to strict::import
4353µs292µs
# spent 56µs (19+36) within DateTime::TimeZone::Local::BEGIN@4 which was called: # once (19µs+36µs) by DateTime::TimeZone::BEGIN@12 at line 4
use warnings;
# spent 56µs making 1 call to DateTime::TimeZone::Local::BEGIN@4 # spent 36µs making 1 call to warnings::import
5
63107µs2145µs
# spent 81µs (16+64) within DateTime::TimeZone::Local::BEGIN@6 which was called: # once (16µs+64µs) by DateTime::TimeZone::BEGIN@12 at line 6
use vars qw( $VERSION );
# spent 81µs making 1 call to DateTime::TimeZone::Local::BEGIN@6 # spent 64µs making 1 call to vars::import
712µs$VERSION = '0.01';
8
9347µs111µs
# spent 11µs within DateTime::TimeZone::Local::BEGIN@9 which was called: # once (11µs+0s) by DateTime::TimeZone::BEGIN@12 at line 9
use DateTime::TimeZone;
# spent 11µs making 1 call to DateTime::TimeZone::Local::BEGIN@9
103701µs118µs
# spent 18µs within DateTime::TimeZone::Local::BEGIN@10 which was called: # once (18µs+0s) by DateTime::TimeZone::BEGIN@12 at line 10
use File::Spec;
# spent 18µs making 1 call to DateTime::TimeZone::Local::BEGIN@10
11
12sub TimeZone {
13 my $class = shift;
14
15 my $subclass = $class->_load_subclass();
16
17 for my $meth ( $subclass->Methods() ) {
18 my $tz = $subclass->$meth();
19
20 return $tz if $tz;
21 }
22
23 die "Cannot determine local time zone\n";
24}
25
26{
27 # Stolen from File::Spec. My theory is that other folks can write
28 # the non-existent modules if they feel a need, and release them
29 # to CPAN separately.
302549µs my %subclass = (
31 MSWin32 => 'Win32',
32 VMS => 'VMS',
33 MacOS => 'Mac',
34 os2 => 'OS2',
35 epoc => 'Epoc',
36 NetWare => 'Win32',
37 symbian => 'Win32',
38 dos => 'OS2',
39 cygwin => 'Unix',
40 );
41
42 sub _load_subclass {
43 my $class = shift;
44
45 my $os_name = $subclass{$^O} || $^O;
46 my $subclass = $class . '::' . $os_name;
47
48 return $subclass if $subclass->can('Methods');
49
50 local $@;
51 local $SIG{__DIE__};
52 eval "use $subclass";
53 if ( my $e = $@ ) {
54 if ( $e =~ /locate.+$os_name/ ) {
55 $subclass = $class . '::' . 'Unix';
56
57 eval "use $subclass";
58 my $e2 = $@;
59 die $e2 if $e2;
60 }
61 else {
62 die $e;
63 }
64 }
65
66 return $subclass;
67 }
68}
69
70sub FromEnv {
71 my $class = shift;
72
73 foreach my $var ( $class->EnvVars() ) {
74 if ( $class->_IsValidName( $ENV{$var} ) ) {
75 my $tz;
76 {
77 local $@;
78 local $SIG{__DIE__};
79 $tz = eval { DateTime::TimeZone->new( name => $ENV{$var} ) };
80 }
81 return $tz if $tz;
82 }
83 }
84
85 return;
86}
87
88sub _IsValidName {
89 shift;
90
91 return 0 unless defined $_[0];
92 return 0 if $_[0] eq 'local';
93
94 return $_[0] =~ m{^[\w/\-\+]+$};
95}
96
97112µs1;
98
99__END__