| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/vars.pm |
| Statements | Executed 295 statements in 6.84ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 16 | 16 | 15 | 3.50ms | 4.44ms | vars::import |
| 165 | 3 | 1 | 946µs | 946µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 875µs | 1.26ms | vars::BEGIN@7 |
| 1 | 1 | 1 | 130µs | 130µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 34µs | 116µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 3 | 269µs | 1 | 130µs | # spent 130µs within vars::BEGIN@3 which was called:
# once (130µs+0s) by base::BEGIN@4 at line 3 # spent 130µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 4µs | our $VERSION = '1.01'; | ||
| 6 | |||||
| 7 | 3 | 937µs | 2 | 1.64ms | # spent 1.26ms (875µs+385µs) within vars::BEGIN@7 which was called:
# once (875µs+385µs) by base::BEGIN@4 at line 7 # spent 1.26ms making 1 call to vars::BEGIN@7
# spent 385µs making 1 call to warnings::register::import |
| 8 | 3 | 1.07ms | 2 | 198µs | # spent 116µs (34+82) within vars::BEGIN@8 which was called:
# once (34µs+82µs) by base::BEGIN@4 at line 8 # spent 116µs making 1 call to vars::BEGIN@8
# spent 82µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 4.44ms (3.50+946µs) within vars::import which was called 16 times, avg 278µs/call:
# once (446µs+120µs) by Params::Validate::BEGIN@7 at line 7 of Params/Validate.pm
# once (354µs+95µs) by HTML::Stream::BEGIN@424 at line 424 of HTML/Stream.pm
# once (311µs+81µs) by List::Util::BEGIN@12 at line 12 of List/Util.pm
# once (275µs+80µs) by Carp::Clan::BEGIN@17 at line 17 of Carp/Clan.pm
# once (268µs+72µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (255µs+66µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm
# once (250µs+66µs) by Try::Tiny::BEGIN@6 at line 6 of Try/Tiny.pm
# once (241µs+68µs) by PadWalker::BEGIN@4 at line 4 of PadWalker.pm
# once (237µs+66µs) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (212µs+55µs) by Digest::SHA1::BEGIN@4 at line 4 of Digest/SHA1.pm
# once (141µs+38µs) by Devel::GlobalDestruction::BEGIN@8 at line 8 of Devel/GlobalDestruction.pm
# once (131µs+38µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (107µs+27µs) by base::BEGIN@4 at line 4 of base.pm
# once (97µs+25µs) by HTML::Stream::Latin1::BEGIN@1435 at line 1435 of HTML/Stream.pm
# once (88µs+26µs) by namespace::clean::BEGIN@13 at line 13 of namespace/clean.pm
# once (84µs+24µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm | ||||
| 11 | 284 | 4.56ms | my $callpack = caller; | ||
| 12 | my ($pack, @imports) = @_; | ||||
| 13 | my ($sym, $ch); | ||||
| 14 | foreach (@imports) { | ||||
| 15 | 55 | 574µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 574µs making 55 calls to vars::CORE:match, avg 10µs/call | ||
| 16 | 55 | 194µs | if ($sym =~ /\W/) { # spent 194µs making 55 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 | 55 | 178µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 178µs making 55 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 |