← 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 17:10:45 2013
Reported on Tue Oct 15 17:12:22 2013

Filename/usr/share/perl5/DateTime/TimeZone/Local.pm
StatementsExecuted 19 statements in 613µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11119µs24µsDateTime::TimeZone::Local::::BEGIN@3DateTime::TimeZone::Local::BEGIN@3
11117µs44µsDateTime::TimeZone::Local::::BEGIN@4DateTime::TimeZone::Local::BEGIN@4
11113µs13µsDateTime::TimeZone::Local::::BEGIN@10DateTime::TimeZone::Local::BEGIN@10
11110µs41µsDateTime::TimeZone::Local::::BEGIN@6DateTime::TimeZone::Local::BEGIN@6
1117µs7µ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
3334µs229µs
# spent 24µs (19+5) within DateTime::TimeZone::Local::BEGIN@3 which was called: # once (19µs+5µs) by DateTime::TimeZone::BEGIN@12 at line 3
use strict;
# spent 24µs making 1 call to DateTime::TimeZone::Local::BEGIN@3 # spent 5µs making 1 call to strict::import
4343µs270µs
# spent 44µs (17+26) within DateTime::TimeZone::Local::BEGIN@4 which was called: # once (17µs+26µs) by DateTime::TimeZone::BEGIN@12 at line 4
use warnings;
# spent 44µs making 1 call to DateTime::TimeZone::Local::BEGIN@4 # spent 26µs making 1 call to warnings::import
5
6340µs272µs
# spent 41µs (10+31) within DateTime::TimeZone::Local::BEGIN@6 which was called: # once (10µs+31µs) by DateTime::TimeZone::BEGIN@12 at line 6
use vars qw( $VERSION );
# spent 41µs making 1 call to DateTime::TimeZone::Local::BEGIN@6 # spent 31µs making 1 call to vars::import
712µs$VERSION = '0.01';
8
9326µs17µs
# spent 7µs within DateTime::TimeZone::Local::BEGIN@9 which was called: # once (7µs+0s) by DateTime::TimeZone::BEGIN@12 at line 9
use DateTime::TimeZone;
# spent 7µs making 1 call to DateTime::TimeZone::Local::BEGIN@9
103448µs113µs
# spent 13µs within DateTime::TimeZone::Local::BEGIN@10 which was called: # once (13µs+0s) by DateTime::TimeZone::BEGIN@12 at line 10
use File::Spec;
# spent 13µ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.
30213µ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
9719µs1;
98
99__END__