| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/vars.pm |
| Statements | Executed 247 statements in 6.12ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 15 | 15 | 15 | 2.98ms | 3.79ms | vars::import |
| 1 | 1 | 1 | 935µs | 1.33ms | vars::BEGIN@7 |
| 132 | 3 | 1 | 809µs | 809µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 97µs | 97µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 36µs | 108µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 3 | 188µs | 1 | 97µs | # spent 97µs within vars::BEGIN@3 which was called:
# once (97µs+0s) by Scalar::Util::BEGIN@10 at line 3 # spent 97µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 4µs | our $VERSION = '1.01'; | ||
| 6 | |||||
| 7 | 3 | 1.02ms | 2 | 1.73ms | # spent 1.33ms (935µs+396µs) within vars::BEGIN@7 which was called:
# once (935µs+396µs) by Scalar::Util::BEGIN@10 at line 7 # spent 1.33ms making 1 call to vars::BEGIN@7
# spent 396µs making 1 call to warnings::register::import |
| 8 | 3 | 1.01ms | 2 | 181µs | # spent 108µs (36+72) within vars::BEGIN@8 which was called:
# once (36µs+72µs) by Scalar::Util::BEGIN@10 at line 8 # spent 108µs making 1 call to vars::BEGIN@8
# spent 72µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 3.79ms (2.98+809µs) within vars::import which was called 15 times, avg 253µs/call:
# once (330µs+88µs) by Time::HiRes::BEGIN@4 at line 4 of Time/HiRes.pm
# once (310µs+100µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm
# once (288µs+76µs) by Try::Tiny::BEGIN@6 at line 6 of Try/Tiny.pm
# once (277µs+79µs) by List::Util::BEGIN@12 at line 12 of List/Util.pm
# once (283µs+67µs) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (242µs+63µs) by Set::Object::BEGIN@499 at line 499 of Set/Object.pm
# once (236µs+65µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (178µs+38µs) by Devel::GlobalDestruction::BEGIN@8 at line 8 of Devel/GlobalDestruction.pm
# once (161µs+39µs) by Set::Object::Weak::BEGIN@31 at line 31 of Set/Object/Weak.pm
# once (152µs+39µs) by Data::UUID::LibUUID::BEGIN@7 at line 7 of Data/UUID/LibUUID.pm
# once (132µs+45µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (138µs+39µs) by Tie::ToObject::BEGIN@8 at line 8 of Tie/ToObject.pm
# once (89µs+25µs) by namespace::clean::BEGIN@13 at line 13 of namespace/clean.pm
# once (84µs+24µs) by base::BEGIN@4 at line 4 of base.pm
# once (81µs+22µs) by Memoize::BEGIN@29 at line 29 of Memoize.pm | ||||
| 11 | 236 | 3.90ms | my $callpack = caller; | ||
| 12 | my ($pack, @imports) = @_; | ||||
| 13 | my ($sym, $ch); | ||||
| 14 | foreach (@imports) { | ||||
| 15 | 44 | 513µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 513µs making 44 calls to vars::CORE:match, avg 12µs/call | ||
| 16 | 44 | 158µs | if ($sym =~ /\W/) { # spent 158µs making 44 calls to vars::CORE:match, avg 4µ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 | 44 | 139µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 139µs making 44 calls to vars::CORE:match, avg 3µ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 | 11µs | 1; | ||
| 47 | __END__ | ||||
sub vars::CORE:match; # opcode |