| Filename | /home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/vars.pm |
| Statements | Executed 32 statements in 495µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 125µs | 188µs | vars::BEGIN@7 |
| 2 | 2 | 2 | 49µs | 60µs | vars::import |
| 1 | 1 | 1 | 16µs | 16µs | vars::BEGIN@3 |
| 12 | 3 | 1 | 11µs | 11µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 8µs | 21µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 2 | 44µs | 1 | 16µs | # spent 16µs within vars::BEGIN@3 which was called:
# once (16µs+0s) by Config::BEGIN@11 at line 3 # spent 16µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 400ns | our $VERSION = '1.03'; | ||
| 6 | |||||
| 7 | 2 | 156µs | 2 | 251µs | # spent 188µs (125+63) within vars::BEGIN@7 which was called:
# once (125µs+63µs) by Config::BEGIN@11 at line 7 # spent 188µs making 1 call to vars::BEGIN@7
# spent 63µs making 1 call to warnings::register::import |
| 8 | 2 | 231µs | 2 | 34µs | # spent 21µs (8+13) within vars::BEGIN@8 which was called:
# once (8µs+13µs) by Config::BEGIN@11 at line 8 # spent 21µs making 1 call to vars::BEGIN@8
# spent 13µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 60µs (49+11) within vars::import which was called 2 times, avg 30µs/call:
# once (25µs+6µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (24µs+5µs) by Config::BEGIN@11 at line 11 of Config.pm | ||||
| 11 | 2 | 1µs | my $callpack = caller; | ||
| 12 | 2 | 2µs | my (undef, @imports) = @_; | ||
| 13 | 2 | 500ns | my ($sym, $ch); | ||
| 14 | 2 | 7µs | foreach (@imports) { | ||
| 15 | 4 | 23µs | 4 | 7µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 7µs making 4 calls to vars::CORE:match, avg 2µs/call |
| 16 | 4 | 7µs | 4 | 2µs | if ($sym =~ /\W/) { # spent 2µs making 4 calls to vars::CORE:match, avg 575ns/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 | 4 | 8µs | 4 | 1µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 1µs making 4 calls to vars::CORE:match, avg 275ns/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 4 | 11µs | : 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 | 2µs | 1; | ||
| 47 | __END__ | ||||
sub vars::CORE:match; # opcode |