Filename | /usr/share/perl/5.18/vars.pm |
Statements | Executed 184 statements in 982µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
9 | 9 | 8 | 335µs | 411µs | import | vars::
1 | 1 | 1 | 199µs | 264µs | BEGIN@7 | vars::
105 | 3 | 1 | 76µs | 76µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 15µs | 15µs | BEGIN@3 | vars::
1 | 1 | 1 | 6µs | 16µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 51µs | 1 | 15µs | # spent 15µs within vars::BEGIN@3 which was called:
# once (15µs+0s) by Config::BEGIN@11 at line 3 # spent 15µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 600ns | our $VERSION = '1.03'; | ||
6 | |||||
7 | 2 | 219µs | 2 | 328µs | # spent 264µs (199+65) within vars::BEGIN@7 which was called:
# once (199µs+65µs) by Config::BEGIN@11 at line 7 # spent 264µs making 1 call to vars::BEGIN@7
# spent 65µs making 1 call to warnings::register::import |
8 | 2 | 279µs | 2 | 26µs | # spent 16µs (6+10) within vars::BEGIN@8 which was called:
# once (6µs+10µs) by Config::BEGIN@11 at line 8 # spent 16µs making 1 call to vars::BEGIN@8
# spent 10µs making 1 call to strict::import |
9 | |||||
10 | # spent 411µs (335+76) within vars::import which was called 9 times, avg 46µs/call:
# once (58µs+13µs) by NetAddr::IP::Lite::BEGIN@33 at line 33 of NetAddr/IP/Lite.pm
# once (52µs+12µs) by Socket6::BEGIN@39 at line 39 of Socket6.pm
# once (51µs+12µs) by NetAddr::IP::BEGIN@25 at line 25 of NetAddr/IP.pm
# once (48µs+10µs) by NetAddr::IP::InetBase::BEGIN@8 at line 8 of NetAddr/IP/InetBase.pm
# once (44µs+10µs) by NetAddr::IP::Util::BEGIN@8 at line 8 of NetAddr/IP/Util.pm
# once (26µs+6µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (26µs+6µs) by NetAddr::IP::InetBase::BEGIN@125 at line 125 of NetAddr/IP/InetBase.pm
# once (16µs+3µs) by NetAddr::IP::Util_IS::BEGIN@8 at line 8 of NetAddr/IP/Util_IS.pm
# once (14µs+3µs) by base::BEGIN@4 at line 4 of base.pm | ||||
11 | 9 | 6µs | my $callpack = caller; | ||
12 | 9 | 17µs | my (undef, @imports) = @_; | ||
13 | 9 | 2µs | my ($sym, $ch); | ||
14 | 9 | 38µs | foreach (@imports) { | ||
15 | 35 | 158µs | 35 | 52µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 52µs making 35 calls to vars::CORE:match, avg 1µs/call |
16 | 35 | 52µs | 35 | 13µs | if ($sym =~ /\W/) { # spent 13µs making 35 calls to vars::CORE:match, avg 380ns/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 | 35 | 61µs | 35 | 10µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 10µs making 35 calls to vars::CORE:match, avg 297ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 35 | 94µ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 |