Filename | /usr/lib/perl5/5.12.4/vars.pm |
Statements | Executed 259 statements in 8.66ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
16 | 16 | 16 | 4.22ms | 5.33ms | import | vars::
1 | 1 | 1 | 1.34ms | 2.00ms | BEGIN@7 | vars::
138 | 3 | 1 | 1.11ms | 1.11ms | CORE:match (opcode) | vars::
1 | 1 | 1 | 143µs | 143µs | BEGIN@3 | vars::
1 | 1 | 1 | 48µs | 168µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 3 | 308µs | 1 | 143µs | # spent 143µs within vars::BEGIN@3 which was called:
# once (143µs+0s) by Scalar::Util::BEGIN@10 at line 3 # spent 143µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 5µs | our $VERSION = '1.01'; | ||
6 | |||||
7 | 3 | 1.43ms | 2 | 2.66ms | # spent 2.00ms (1.34+658µs) within vars::BEGIN@7 which was called:
# once (1.34ms+658µs) by Scalar::Util::BEGIN@10 at line 7 # spent 2.00ms making 1 call to vars::BEGIN@7
# spent 658µs making 1 call to warnings::register::import |
8 | 3 | 1.43ms | 2 | 289µs | # spent 168µs (48+121) within vars::BEGIN@8 which was called:
# once (48µs+121µs) by Scalar::Util::BEGIN@10 at line 8 # spent 168µs making 1 call to vars::BEGIN@8
# spent 121µs making 1 call to strict::import |
9 | |||||
10 | # spent 5.33ms (4.22+1.11) within vars::import which was called 16 times, avg 333µs/call:
# once (456µs+114µs) by DateTime::TimeZone::Catalog::BEGIN@12 at line 12 of DateTime/TimeZone/Catalog.pm
# once (413µs+131µs) by Math::Round::BEGIN@5 at line 5 of Math/Round.pm
# once (409µs+109µs) by List::Util::BEGIN@12 at line 12 of List/Util.pm
# once (406µs+111µs) by POSIX::SigRt::BEGIN@66 at line 66 of POSIX.pm
# once (388µs+91µs) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (364µs+91µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm
# once (330µs+89µs) by Try::Tiny::BEGIN@6 at line 6 of Try/Tiny.pm
# once (252µs+69µs) by Params::Validate::BEGIN@15 at line 15 of Params/Validate.pm
# once (241µs+54µs) by DateTime::TimeZone::Floating::BEGIN@5 at line 5 of DateTime/TimeZone/Floating.pm
# once (190µs+47µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (180µs+52µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (121µs+31µs) by DateTime::TimeZone::OffsetOnly::BEGIN@5 at line 5 of DateTime/TimeZone/OffsetOnly.pm
# once (122µs+29µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm
# once (118µs+29µs) by DateTime::TimeZone::UTC::BEGIN@5 at line 5 of DateTime/TimeZone/UTC.pm
# once (116µs+31µs) by DateTime::TimeZone::Local::BEGIN@6 at line 6 of DateTime/TimeZone/Local.pm
# once (115µs+30µs) by base::BEGIN@4 at line 4 of base.pm | ||||
11 | 16 | 123µs | my $callpack = caller; | ||
12 | 16 | 194µs | my ($pack, @imports) = @_; | ||
13 | 16 | 52µs | my ($sym, $ch); | ||
14 | 16 | 473µs | foreach (@imports) { | ||
15 | 46 | 1.97ms | 46 | 687µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 687µs making 46 calls to vars::CORE:match, avg 15µs/call |
16 | 46 | 773µs | 46 | 230µs | if ($sym =~ /\W/) { # spent 230µs making 46 calls to vars::CORE:match, avg 5µ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 | 46 | 813µs | 46 | 190µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 190µs making 46 calls to vars::CORE:match, avg 4µ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 | 46 | 1.08ms | : 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 | 15µs | 1; | ||
47 | __END__ | ||||
sub vars::CORE:match; # opcode |