Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/5.16.3/vars.pm |
Statements | Executed 144 statements in 1.03ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
11 | 11 | 11 | 358µs | 441µs | import | vars::
1 | 1 | 1 | 190µs | 279µs | BEGIN@7 | vars::
69 | 3 | 1 | 82µs | 82µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 16µs | 16µs | BEGIN@3 | vars::
1 | 1 | 1 | 9µs | 21µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 62µ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 | 700ns | our $VERSION = '1.02'; | ||
6 | |||||
7 | 2 | 209µs | 2 | 368µs | # spent 279µs (190+89) within vars::BEGIN@7 which was called:
# once (190µs+89µs) by Config::BEGIN@11 at line 7 # spent 279µs making 1 call to vars::BEGIN@7
# spent 89µs making 1 call to warnings::register::import |
8 | 2 | 287µs | 2 | 34µs | # spent 21µs (9+13) within vars::BEGIN@8 which was called:
# once (9µ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 441µs (358+82) within vars::import which was called 11 times, avg 40µs/call:
# once (56µs+13µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm
# once (53µs+12µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (41µs+9µs) by Text::Balanced::BEGIN@11 at line 11 of Text/Balanced.pm
# once (39µs+10µs) by Iterator::Util::BEGIN@21 at line 21 of Iterator/Util.pm
# once (34µs+8µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (30µs+7µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (26µs+5µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (24µs+5µs) by SelfLoader::BEGIN@9 at line 9 of SelfLoader.pm
# once (19µs+5µs) by base::BEGIN@4 at line 4 of base.pm
# once (19µs+4µs) by Class::Data::Inheritable::BEGIN@4 at line 4 of Class/Data/Inheritable.pm
# once (18µs+4µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm | ||||
11 | 11 | 10µs | my $callpack = caller; | ||
12 | 11 | 20µs | my (undef, @imports) = @_; | ||
13 | 11 | 4µs | my ($sym, $ch); | ||
14 | 11 | 60µs | foreach (@imports) { | ||
15 | 23 | 171µs | 23 | 57µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 57µs making 23 calls to vars::CORE:match, avg 2µs/call |
16 | 23 | 54µs | 23 | 14µs | if ($sym =~ /\W/) { # spent 14µs making 23 calls to vars::CORE:match, avg 630ns/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 | 23 | 60µs | 23 | 11µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 11µs making 23 calls to vars::CORE:match, avg 478ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 23 | 93µ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 | 3µs | 1; | ||
47 | __END__ | ||||
sub vars::CORE:match; # opcode |