Filename | /opt/perl-5.18.1/lib/5.18.1/vars.pm |
Statements | Executed 88 statements in 1.00ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 258µs | 361µs | BEGIN@7 | vars::
6 | 6 | 6 | 221µs | 268µs | import | vars::
42 | 3 | 1 | 47µs | 47µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 18µs | 18µs | BEGIN@3 | vars::
1 | 1 | 1 | 8µs | 22µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 72µs | 1 | 18µs | # spent 18µs within vars::BEGIN@3 which was called:
# once (18µs+0s) by base::BEGIN@4 at line 3 # spent 18µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 800ns | our $VERSION = '1.03'; | ||
6 | |||||
7 | 2 | 281µs | 2 | 464µs | # spent 361µs (258+103) within vars::BEGIN@7 which was called:
# once (258µs+103µs) by base::BEGIN@4 at line 7 # spent 361µs making 1 call to vars::BEGIN@7
# spent 103µs making 1 call to warnings::register::import |
8 | 2 | 375µs | 2 | 36µs | # spent 22µs (8+14) within vars::BEGIN@8 which was called:
# once (8µs+14µs) by base::BEGIN@4 at line 8 # spent 22µs making 1 call to vars::BEGIN@8
# spent 14µs making 1 call to strict::import |
9 | |||||
10 | # spent 268µs (221+47) within vars::import which was called 6 times, avg 45µs/call:
# once (57µs+11µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (50µs+11µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm
# once (32µs+7µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (31µs+6µs) by base::BEGIN@4 at line 4 of base.pm
# once (28µs+7µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (22µs+5µs) by parent::BEGIN@3 at line 3 of parent.pm | ||||
11 | 6 | 6µs | my $callpack = caller; | ||
12 | 6 | 10µs | my (undef, @imports) = @_; | ||
13 | 6 | 1µs | my ($sym, $ch); | ||
14 | 6 | 32µs | foreach (@imports) { | ||
15 | 14 | 110µs | 14 | 35µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 35µs making 14 calls to vars::CORE:match, avg 3µs/call |
16 | 14 | 28µs | 14 | 7µs | if ($sym =~ /\W/) { # spent 7µs making 14 calls to vars::CORE:match, avg 471ns/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 | 14 | 35µs | 14 | 6µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 6µs making 14 calls to vars::CORE:match, avg 393ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 14 | 51µ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 |