← Index
Performance Profile   « block view • line view • sub view »
For opac/opac-main.pl
  Run on Mon Aug 24 11:28:47 2009
Reported on Mon Aug 24 11:29:09 2009

File /usr/share/perl/5.10/constant.pm
Statements Executed 5130
Total Time 0.00782909999999984 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
222222206.54ms8.11msconstant::::importconstant::import
0000s0sconstant::::BEGINconstant::BEGIN
0000s0sconstant::::__ANON__[:115]constant::__ANON__[:115]
0000s0sconstant::::__ANON__[:119]constant::__ANON__[:119]
0000s0sconstant::::__ANON__[:121]constant::__ANON__[:121]
LineStmts.Exclusive
Time
Avg.Code
1package constant;
2342µs14µsuse 5.005;
3326µs9µsuse strict;
# spent 8µs making 1 call to strict::import
4331µs10µsuse warnings::register;
# spent 76µs making 1 call to warnings::register::import
5
63152µs51µsuse vars qw($VERSION %declared);
# spent 33µs making 1 call to vars::import
71900ns900ns$VERSION = '1.13';
8
9#=======================================================================
10
11# Some names are evil choices.
12112µs12µsmy %keywords = map +($_, 1), qw{ BEGIN INIT CHECK END DESTROY AUTOLOAD };
1314µs4µs$keywords{UNITCHECK}++ if $] > 5.009;
14
1518µs8µsmy %forced_into_main = map +($_, 1),
16 qw{ STDIN STDOUT STDERR ARGV ARGVOUT ENV INC SIG };
17
1818µs8µsmy %forbidden = (%keywords, %forced_into_main);
19
20#=======================================================================
21# import() - import symbols into user's namespace
22#
23# What we actually do is define a function in the caller's namespace
24# which returns the value. The function we create will normally
25# be inlined as a constant, thereby avoiding further sub calling
26# overhead.
27#=======================================================================
28
# spent 8.11ms (6.54+1.57) within constant::import which was called 222 times, avg 37µs/call: # once (63µs+12µs) at line 41 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (51µs+21µs) by CGI::BEGIN at line 32 of /usr/share/perl/5.10/CGI.pm # once (50µs+10µs) at line 28 of /usr/share/perl/5.10/Time/Local.pm # once (49µs+10µs) at line 12 of /usr/share/perl5/YAML.pm # once (48µs+9µs) at line 462 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (46µs+10µs) by YAML::Syck::BEGIN at line 52 of /usr/lib/perl5/YAML/Syck.pm # once (46µs+10µs) at line 20 of /usr/local/share/perl/5.10.0/XML/SAX.pm # once (47µs+9µs) by MultipartBuffer::BEGIN at line 3714 of /usr/share/perl/5.10/CGI.pm # once (45µs+10µs) at line 8 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (44µs+11µs) at line 184 of /home/chris/git/koha.git/C4/Context.pm # once (43µs+11µs) at line 65 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (43µs+10µs) at line 22 of /usr/share/perl5/MARC/Charset/Constants.pm # once (43µs+10µs) at line 7 of /usr/share/perl5/MARC/Field.pm # once (43µs+10µs) at line 19 of /usr/share/perl5/MARC/File/USMARC.pm # once (42µs+10µs) at line 54 of /usr/share/perl5/Compress/Zlib.pm # once (40µs+10µs) at line 140 of /usr/lib/perl5/XML/LibXML/Common.pm # once (40µs+8µs) at line 461 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (41µs+7µs) at line 179 of /usr/lib/perl5/XML/LibXML/Common.pm # once (39µs+9µs) at line 14 of /usr/share/perl5/IO/Uncompress/Base.pm # once (40µs+8µs) at line 818 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (40µs+7µs) at line 84 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (39µs+7µs) at line 112 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (38µs+7µs) at line 70 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (36µs+7µs) at line 55 of /usr/share/perl5/Compress/Zlib.pm # once (36µs+7µs) at line 182 of /usr/lib/perl5/XML/LibXML/Common.pm # once (34µs+8µs) at line 31 of /usr/share/perl5/Cache/Memcached.pm # once (34µs+8µs) at line 70 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (34µs+7µs) by MARC::Record::BEGIN at line 34 of /usr/share/perl5/MARC/Record.pm # once (34µs+7µs) at line 152 of /usr/lib/perl5/XML/LibXML/Common.pm # once (34µs+7µs) at line 83 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (33µs+7µs) at line 141 of /usr/lib/perl5/XML/LibXML/Common.pm # once (32µs+8µs) at line 130 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (33µs+7µs) at line 31 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (33µs+7µs) at line 474 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (33µs+7µs) at line 113 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (33µs+7µs) at line 14 of /usr/local/lib/perl/5.10.0/XML/LibXML.pm # once (32µs+7µs) at line 76 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (33µs+7µs) at line 196 of /usr/lib/perl5/XML/LibXML/Common.pm # once (32µs+7µs) at line 92 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (32µs+7µs) at line 173 of /usr/lib/perl5/XML/LibXML/Common.pm # once (32µs+7µs) at line 17 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (32µs+7µs) at line 145 of /usr/lib/perl5/XML/LibXML/Common.pm # once (32µs+7µs) at line 109 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (32µs+7µs) at line 101 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (32µs+7µs) at line 82 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (32µs+7µs) at line 174 of /usr/lib/perl5/XML/LibXML/Common.pm # once (31µs+7µs) at line 212 of /usr/lib/perl5/XML/LibXML/Common.pm # once (31µs+7µs) at line 184 of /usr/lib/perl5/XML/LibXML/Common.pm # once (31µs+7µs) at line 209 of /usr/lib/perl5/XML/LibXML/Common.pm # once (30µs+8µs) at line 42 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (31µs+7µs) at line 34 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (31µs+7µs) at line 35 of /usr/share/perl5/MARC/Charset/Constants.pm # once (31µs+7µs) at line 110 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (31µs+7µs) at line 171 of /usr/lib/perl5/XML/LibXML/Common.pm # once (31µs+7µs) by XML::LibXML::Common::BEGIN at line 213 of /usr/lib/perl5/XML/LibXML/Common.pm # once (30µs+7µs) at line 43 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (30µs+7µs) at line 37 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (30µs+7µs) by IO::Compress::Gzip::Constants::BEGIN at line 143 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (30µs+7µs) at line 9 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (30µs+7µs) at line 204 of /usr/lib/perl5/XML/LibXML/Common.pm # once (30µs+7µs) at line 188 of /usr/lib/perl5/XML/LibXML/Common.pm # once (30µs+7µs) at line 87 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (29µs+7µs) at line 115 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (28µs+8µs) at line 207 of /usr/lib/perl5/XML/LibXML/Common.pm # once (28µs+7µs) at line 66 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (29µs+7µs) at line 114 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (28µs+7µs) at line 475 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (29µs+6µs) at line 22 of /usr/local/share/perl/5.10.0/XML/SAX.pm # once (28µs+7µs) at line 11 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (28µs+7µs) at line 9 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (28µs+7µs) at line 85 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (28µs+7µs) at line 8 of /usr/share/perl5/MARC/Field.pm # once (28µs+7µs) at line 44 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (28µs+7µs) at line 67 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (28µs+7µs) at line 71 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (28µs+6µs) at line 30 of /usr/share/perl5/MARC/Charset/Constants.pm # once (28µs+6µs) at line 29 of /usr/share/perl/5.10/Time/Local.pm # once (27µs+7µs) at line 180 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 77 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (28µs+7µs) at line 144 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 15 of /usr/share/perl5/IO/Uncompress/Base.pm # once (28µs+7µs) at line 463 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (28µs+7µs) at line 149 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 131 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (28µs+7µs) by Time::Local::BEGIN at line 30 of /usr/share/perl/5.10/Time/Local.pm # once (28µs+7µs) at line 24 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 143 of /usr/lib/perl5/XML/LibXML/Common.pm # once (28µs+7µs) at line 471 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 88 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 69 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 73 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (28µs+7µs) at line 40 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 13 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (27µs+7µs) at line 142 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 466 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 208 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 12 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (27µs+7µs) at line 464 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 119 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 111 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 134 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 473 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+6µs) at line 26 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 150 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 465 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 114 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 210 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 35 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+6µs) at line 20 of /usr/share/perl5/MARC/File/USMARC.pm # once (27µs+7µs) at line 78 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 84 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+6µs) at line 25 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 147 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+6µs) at line 57 of /usr/share/perl5/Compress/Zlib.pm # once (27µs+7µs) at line 86 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+6µs) at line 151 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 469 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (26µs+7µs) at line 132 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) by MARC::File::USMARC::BEGIN at line 22 of /usr/share/perl5/MARC/File/USMARC.pm # once (27µs+7µs) at line 90 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 74 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+6µs) at line 32 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+6µs) at line 29 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+6µs) at line 41 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 10 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (26µs+7µs) at line 478 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 102 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (27µs+7µs) at line 80 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 15 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+7µs) at line 32 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 39 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 156 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 154 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+6µs) by XML::SAX::BEGIN at line 23 of /usr/local/share/perl/5.10.0/XML/SAX.pm # once (27µs+6µs) at line 14 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (27µs+6µs) at line 27 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) by Compress::Raw::Zlib::BEGIN at line 115 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (27µs+6µs) at line 21 of /usr/share/perl5/MARC/File/USMARC.pm # once (27µs+7µs) at line 34 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+7µs) at line 172 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 185 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 146 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+7µs) at line 35 of /usr/share/perl5/Cache/Memcached.pm # once (27µs+6µs) at line 32 of /usr/share/perl5/Cache/Memcached.pm # once (27µs+7µs) at line 75 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+7µs) at line 26 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+6µs) at line 27 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+6µs) at line 20 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 477 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (27µs+7µs) at line 189 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 470 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (26µs+7µs) at line 89 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (27µs+6µs) at line 181 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 87 of /usr/share/perl5/IO/Compress/Gzip/Constants.pm # once (26µs+7µs) at line 22 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+6µs) at line 165 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 113 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+7µs) at line 11 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 16 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 14 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (27µs+6µs) at line 36 of /usr/share/perl5/MARC/Charset/Constants.pm # once (27µs+6µs) at line 15 of /usr/local/lib/perl/5.10.0/XML/LibXML.pm # once (27µs+6µs) at line 201 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+6µs) at line 153 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 203 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 18 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+6µs) at line 45 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+7µs) at line 170 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 162 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 155 of /usr/lib/perl5/XML/LibXML/Common.pm # once (27µs+6µs) at line 176 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 195 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 56 of /usr/share/perl5/Compress/Zlib.pm # once (26µs+7µs) at line 106 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+7µs) at line 108 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+6µs) at line 30 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 29 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 10 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+6µs) at line 46 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+7µs) at line 44 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+6µs) at line 206 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 148 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 183 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 164 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 31 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+6µs) at line 163 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 24 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 194 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 175 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 476 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (26µs+7µs) at line 186 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 21 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+6µs) at line 37 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+6µs) at line 157 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) by Cache::Memcached::GetParser::BEGIN at line 15 of /usr/share/perl5/Cache/Memcached/GetParser.pm # once (26µs+7µs) at line 86 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+6µs) at line 28 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 200 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 197 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) by MARC::Charset::Constants::BEGIN at line 47 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+6µs) at line 43 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+7µs) at line 202 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 205 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+6µs) at line 819 of /usr/share/perl5/IO/Compress/Base/Common.pm # once (26µs+7µs) at line 104 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+7µs) at line 105 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+7µs) at line 103 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+6µs) at line 25 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+6µs) at line 12 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 178 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 211 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 33 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+7µs) at line 23 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+6µs) at line 198 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 199 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 111 of /usr/lib/perl5/Compress/Raw/Zlib.pm # once (26µs+6µs) at line 187 of /usr/lib/perl5/XML/LibXML/Common.pm # once (26µs+7µs) at line 42 of /usr/share/perl5/MARC/Charset/Constants.pm # once (26µs+6µs) at line 36 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (26µs+6µs) at line 19 of /usr/local/lib/perl/5.10.0/XML/LibXML/Error.pm # once (25µs+7µs) at line 177 of /usr/lib/perl5/XML/LibXML/Common.pm # once (25µs+6µs) by U64::BEGIN at line 820 of /usr/share/perl5/IO/Compress/Base/Common.pm
sub import {
2951066.99ms1µs my $class = shift;
30 return unless @_; # Ignore 'use constant;'
31 my $constants;
32 my $multiple = ref $_[0];
33 my $pkg = caller;
34 my $symtab;
35 my $str_end = $] >= 5.006 ? "\\z" : "\\Z";
36
37 if ($] > 5.009002) {
383300µs100µs no strict 'refs';
# spent 24µs making 1 call to strict::unimport
39 $symtab = \%{$pkg . '::'};
40 };
41
42 if ( $multiple ) {
43 if (ref $_[0] ne 'HASH') {
44 require Carp;
45 Carp::croak("Invalid reference type '".ref(shift)."' not 'HASH'");
46 }
47 $constants = shift;
48 } else {
49 $constants->{+shift} = undef;
50 }
51
52 foreach my $name ( keys %$constants ) {
53 unless (defined $name) {
54 require Carp;
55 Carp::croak("Can't use undef as constant name");
56 }
57
58 # Normal constant name
59 if ($name =~ /^_?[^\W_0-9]\w*$str_end/ and !$forbidden{$name}) {
60 # Everything is okay
61
62 # Name forced into main, but we're not in main. Fatal.
63 } elsif ($forced_into_main{$name} and $pkg ne 'main') {
64 require Carp;
65 Carp::croak("Constant name '$name' is forced into main::");
66
67 # Starts with double underscore. Fatal.
68 } elsif ($name =~ /^__/) {
69 require Carp;
70 Carp::croak("Constant name '$name' begins with '__'");
71
72 # Maybe the name is tolerable
73 } elsif ($name =~ /^[A-Za-z_]\w*$str_end/) {
74 # Then we'll warn only if you've asked for warnings
75 if (warnings::enabled()) {
76 if ($keywords{$name}) {
77 warnings::warn("Constant name '$name' is a Perl keyword");
78 } elsif ($forced_into_main{$name}) {
79 warnings::warn("Constant name '$name' is " .
80 "forced into package main::");
81 }
82 }
83
84 # Looks like a boolean
85 # use constant FRED == fred;
86 } elsif ($name =~ /^[01]?$str_end/) {
87 require Carp;
88 if (@_) {
89 Carp::croak("Constant name '$name' is invalid");
90 } else {
91 Carp::croak("Constant name looks like boolean value");
92 }
93
94 } else {
95 # Must have bad characters
96 require Carp;
97 Carp::croak("Constant name '$name' has invalid characters");
98 }
99
100 {
1013248µs83µs no strict 'refs';
# spent 17µs making 1 call to strict::unimport
102 my $full_name = "${pkg}::$name";
103 $declared{$full_name}++;
104 if ($multiple || @_ == 1) {
105 my $scalar = $multiple ? $constants->{$name} : $_[0];
106 if ($symtab && !exists $symtab->{$name}) {
107 # No typeglob yet, so we can use a reference as space-
108 # efficient proxy for a constant subroutine
109 # The check in Perl_ck_rvconst knows that inlinable
110 # constants from cv_const_sv are read only. So we have to:
111 Internals::SvREADONLY($scalar, 1);
# spent 773µs making 222 calls to Internals::SvREADONLY, avg 3µs/call
112 $symtab->{$name} = \$scalar;
113 mro::method_changed_in($pkg);
# spent 794µs making 222 calls to mro::method_changed_in, avg 4µs/call
114 } else {
115 *$full_name = sub () { $scalar };
116 }
117 } elsif (@_) {
118 my @list = @_;
119 *$full_name = sub () { @list };
120 } else {
121 *$full_name = sub () { };
122 }
123 }
124 }
125}
126
127111µs11µs1;
128
129__END__
130