Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/5.18.0/vars.pm |
Statements | Executed 96 statements in 681µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 178µs | 244µs | BEGIN@7 | vars::
6 | 6 | 6 | 165µs | 201µs | import | vars::
48 | 3 | 1 | 35µs | 35µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 13µs | 13µs | BEGIN@3 | vars::
1 | 1 | 1 | 5µs | 14µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 47µs | 1 | 13µs | # spent 13µs within vars::BEGIN@3 which was called:
# once (13µs+0s) by Config::BEGIN@11 at line 3 # spent 13µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 400ns | our $VERSION = '1.03'; | ||
6 | |||||
7 | 2 | 192µs | 2 | 310µs | # spent 244µs (178+66) within vars::BEGIN@7 which was called:
# once (178µs+66µs) by Config::BEGIN@11 at line 7 # spent 244µs making 1 call to vars::BEGIN@7
# spent 66µs making 1 call to warnings::register::import |
8 | 2 | 242µs | 2 | 23µs | # spent 14µs (5+9) within vars::BEGIN@8 which was called:
# once (5µs+9µs) by Config::BEGIN@11 at line 8 # spent 14µs making 1 call to vars::BEGIN@8
# spent 9µs making 1 call to strict::import |
9 | |||||
10 | # spent 201µs (165+35) within vars::import which was called 6 times, avg 33µs/call:
# once (38µs+8µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm
# once (35µs+8µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (31µs+7µs) by Storable::BEGIN@22 at line 22 of Storable.pm
# once (27µs+5µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (22µs+5µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (12µs+3µs) by base::BEGIN@4 at line 4 of base.pm | ||||
11 | 6 | 3µs | my $callpack = caller; | ||
12 | 6 | 7µs | my (undef, @imports) = @_; | ||
13 | 6 | 700ns | my ($sym, $ch); | ||
14 | 6 | 20µs | foreach (@imports) { | ||
15 | 16 | 77µs | 16 | 26µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 26µs making 16 calls to vars::CORE:match, avg 2µs/call |
16 | 16 | 22µs | 16 | 5µs | if ($sym =~ /\W/) { # spent 5µs making 16 calls to vars::CORE:match, avg 331ns/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 | 16 | 26µs | 16 | 4µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 4µs making 16 calls to vars::CORE:match, avg 231ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 16 | 39µ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 |