Filename | /usr/lib/perl5/5.20.1/vars.pm |
Statements | Executed 48 statements in 414µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 120µs | 169µs | BEGIN@7 | vars::
3 | 3 | 3 | 55µs | 66µs | import | vars::
21 | 3 | 1 | 11µs | 11µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 8µs | 8µs | BEGIN@3 | vars::
1 | 1 | 1 | 4µs | 10µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 33µs | 1 | 8µs | # spent 8µs within vars::BEGIN@3 which was called:
# once (8µs+0s) by Config::BEGIN@11 at line 3 # spent 8µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 300ns | our $VERSION = '1.03'; | ||
6 | |||||
7 | 2 | 131µs | 2 | 219µs | # spent 169µs (120+49) within vars::BEGIN@7 which was called:
# once (120µs+49µs) by Config::BEGIN@11 at line 7 # spent 169µs making 1 call to vars::BEGIN@7
# spent 49µs making 1 call to warnings::register::import |
8 | 2 | 180µs | 2 | 17µs | # spent 10µs (4+6) within vars::BEGIN@8 which was called:
# once (4µs+6µs) by Config::BEGIN@11 at line 8 # spent 10µs making 1 call to vars::BEGIN@8
# spent 6µs making 1 call to strict::import |
9 | |||||
10 | # spent 66µs (55+12) within vars::import which was called 3 times, avg 22µs/call:
# once (23µs+5µs) by Storable::BEGIN@23 at line 23 of Storable.pm
# once (18µs+4µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (13µs+3µs) by constant::BEGIN@6 at line 6 of constant.pm | ||||
11 | 3 | 1µs | my $callpack = caller; | ||
12 | 3 | 2µs | my (undef, @imports) = @_; | ||
13 | 3 | 300ns | my ($sym, $ch); | ||
14 | 3 | 7µs | foreach (@imports) { | ||
15 | 7 | 27µs | 7 | 8µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 8µs making 7 calls to vars::CORE:match, avg 1µs/call |
16 | 7 | 8µs | 7 | 2µs | if ($sym =~ /\W/) { # spent 2µs making 7 calls to vars::CORE:match, avg 286ns/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 | 7 | 9µs | 7 | 1µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 1µs making 7 calls to vars::CORE:match, avg 157ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 7 | 13µ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 |