Filename | /usr/share/perl/5.10/vars.pm |
Statements | Executed 259 statements in 2.29ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
22 | 22 | 18 | 1.13ms | 1.38ms | import | vars::
1 | 1 | 1 | 346µs | 511µs | BEGIN@7 | vars::
120 | 3 | 1 | 259µs | 259µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 63µs | 63µs | BEGIN@3 | vars::
1 | 1 | 1 | 12µs | 42µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 3 | 99µs | 1 | 63µs | # spent 63µs within vars::BEGIN@3 which was called:
# once (63µs+0s) by MARC::File::XML::BEGIN@5 at line 3 # spent 63µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 2µs | our $VERSION = '1.01'; | ||
6 | |||||
7 | 3 | 370µs | 2 | 676µs | # spent 511µs (346+165) within vars::BEGIN@7 which was called:
# once (346µs+165µs) by MARC::File::XML::BEGIN@5 at line 7 # spent 511µs making 1 call to vars::BEGIN@7
# spent 165µs making 1 call to warnings::register::import |
8 | 3 | 378µs | 2 | 72µs | # spent 42µs (12+30) within vars::BEGIN@8 which was called:
# once (12µs+30µs) by MARC::File::XML::BEGIN@5 at line 8 # spent 42µs making 1 call to vars::BEGIN@8
# spent 30µs making 1 call to strict::import |
9 | |||||
10 | # spent 1.38ms (1.13+259µs) within vars::import which was called 22 times, avg 63µs/call:
# once (118µs+35µs) by POSIX::SigRt::BEGIN@66 at line 66 of POSIX.pm
# once (103µs+24µs) by XML::SAX::ExpatXS::Encoding::BEGIN@5 at line 5 of XML/SAX/ExpatXS/Encoding.pm
# once (76µs+20µs) by Storable::BEGIN@24 at line 24 of Storable.pm
# once (74µs+20µs) by XML::SAX::BEGIN@6 at line 6 of XML/SAX.pm
# once (72µs+19µs) by MARC::Record::BEGIN@27 at line 27 of MARC/Record.pm
# once (60µs+16µs) by MARC::File::XML::BEGIN@5 at line 5 of MARC/File/XML.pm
# once (63µs+12µs) by XML::SAX::ExpatXS::BEGIN@3 at line 3 of XML/SAX/ExpatXS.pm
# once (59µs+13µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (50µs+12µs) by XML::SAX::Exception::BEGIN@8 at line 8 of XML/SAX/Exception.pm
# once (49µs+12µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (41µs+6µs) by XML::SAX::ExpatXS::Preload::BEGIN@13 at line 13 of XML/SAX/ExpatXS/Preload.pm
# once (37µs+6µs) by MARC::File::USMARC::BEGIN@16 at line 16 of MARC/File/USMARC.pm
# once (36µs+7µs) by MARC::File::USMARC::BEGIN@12 at line 12 of MARC/File/USMARC.pm
# once (36µs+6µs) by MARC::File::BEGIN@12 at line 12 of MARC/File.pm
# once (35µs+6µs) by XML::SAX::Base::BEGIN@29 at line 29 of XML/SAX/Base.pm
# once (33µs+7µs) by MARC::Field::BEGIN@10 at line 10 of MARC/Field.pm
# once (34µs+5µs) by XML::SAX::ParserFactory::BEGIN@6 at line 6 of XML/SAX/ParserFactory.pm
# once (31µs+8µs) by MARC::Record::BEGIN@23 at line 23 of MARC/Record.pm
# once (32µs+7µs) by MARC::Record::BEGIN@12 at line 12 of MARC/Record.pm
# once (31µs+5µs) by MARC::Record::BEGIN@32 at line 32 of MARC/Record.pm
# once (28µs+7µs) by base::BEGIN@4 at line 4 of base.pm
# once (28µs+6µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm | ||||
11 | 248 | 1.44ms | my $callpack = caller; | ||
12 | my ($pack, @imports) = @_; | ||||
13 | my ($sym, $ch); | ||||
14 | foreach (@imports) { | ||||
15 | 40 | 143µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 143µs making 40 calls to vars::CORE:match, avg 4µs/call | ||
16 | 40 | 66µs | if ($sym =~ /\W/) { # spent 66µs making 40 calls to vars::CORE:match, avg 2µs/call | ||
17 | # time for a more-detailed check-up | ||||
18 | if ($sym =~ /^\w+[[{].*[]}]$/) { | ||||
19 | require Carp; | ||||
20 | Carp::croak("Can't declare individual elements of hash or array"); | ||||
21 | } elsif (warnings::enabled() and length($sym) == 1 and $sym !~ tr/a-zA-Z//) { | ||||
22 | warnings::warn("No need to declare built-in vars"); | ||||
23 | } elsif (($^H &= strict::bits('vars'))) { | ||||
24 | require Carp; | ||||
25 | Carp::croak("'$_' is not a valid variable name under strict vars"); | ||||
26 | } | ||||
27 | } | ||||
28 | 40 | 50µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 50µs making 40 calls to vars::CORE:match, avg 1µs/call | ||
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | : do { | ||||
36 | require Carp; | ||||
37 | Carp::croak("'$_' is not a valid variable name"); | ||||
38 | }); | ||||
39 | } else { | ||||
40 | require Carp; | ||||
41 | Carp::croak("'$_' is not a valid variable name"); | ||||
42 | } | ||||
43 | } | ||||
44 | }; | ||||
45 | |||||
46 | 1 | 4µs | 1; | ||
47 | __END__ | ||||
sub vars::CORE:match; # opcode |