Filename | /Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/vars.pm |
Statements | Executed 340 statements in 1.39ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
16 | 16 | 10 | 663µs | 845µs | import | vars::
201 | 3 | 1 | 182µs | 182µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 28µs | 28µs | BEGIN@3 | vars::
1 | 1 | 1 | 6µs | 38µs | BEGIN@7 | vars::
1 | 1 | 1 | 6µs | 12µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 58µs | 1 | 28µs | # spent 28µs within vars::BEGIN@3 which was called:
# once (28µs+0s) by Digest::SHA::BEGIN@7 at line 3 # spent 28µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 1µs | our $VERSION = '1.05'; | ||
6 | |||||
7 | 2 | 26µs | 2 | 70µs | # spent 38µs (6+32) within vars::BEGIN@7 which was called:
# once (6µs+32µs) by Digest::SHA::BEGIN@7 at line 7 # spent 38µs making 1 call to vars::BEGIN@7
# spent 32µs making 1 call to warnings::register::import |
8 | 2 | 413µs | 2 | 18µs | # spent 12µs (6+6) within vars::BEGIN@8 which was called:
# once (6µs+6µs) by Digest::SHA::BEGIN@7 at line 8 # spent 12µs making 1 call to vars::BEGIN@8
# spent 6µs making 1 call to strict::import |
9 | |||||
10 | # spent 845µs (663+182) within vars::import which was called 16 times, avg 53µs/call:
# once (96µs+27µs) by Pod::Escapes::BEGIN@6 at line 16 of Pod/Escapes.pm
# once (85µs+11µs) by List::MoreUtils::PP::BEGIN@413 at line 413 of List/MoreUtils/PP.pm
# once (80µs+11µs) by Digest::SHA::BEGIN@7 at line 7 of Digest/SHA.pm
# once (56µs+17µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm
# once (48µs+13µs) by Getopt::Long::BEGIN@52 at line 52 of Getopt/Long.pm
# once (39µs+18µs) by List::MoreUtils::XS::BEGIN@8 at line 8 of List/MoreUtils/XS.pm
# once (43µs+8µs) by Getopt::Long::BEGIN@49 at line 50 of Getopt/Long.pm
# once (34µs+12µs) by Pod::Text::BEGIN@21 at line 21 of Pod/Text.pm
# once (36µs+10µs) by Pod::Simple::BEGIN@14 at line 19 of Pod/Simple.pm
# once (27µs+18µs) by Getopt::Long::BEGIN@27 at line 27 of Getopt/Long.pm
# once (31µs+6µs) by Getopt::Long::BEGIN@23 at line 23 of Getopt/Long.pm
# once (26µs+5µs) by Getopt::Long::BEGIN@47 at line 47 of Getopt/Long.pm
# once (20µs+11µs) by Pod::Simple::BlackBox::BEGIN@24 at line 24 of Pod/Simple/BlackBox.pm
# once (19µs+8µs) by Getopt::Long::BEGIN@20 at line 20 of Getopt/Long.pm
# once (12µs+5µs) by Pod::Simple::LinkSection::BEGIN@8 at line 8 of Pod/Simple/LinkSection.pm
# once (11µs+2µs) by Pod::Simple::TiedOutFH::BEGIN@6 at line 6 of Pod/Simple/TiedOutFH.pm | ||||
11 | 16 | 10µs | my $callpack = caller; | ||
12 | 16 | 28µs | my (undef, @imports) = @_; | ||
13 | 16 | 3µs | my ($sym, $ch); | ||
14 | 16 | 76µs | foreach (@imports) { | ||
15 | 67 | 296µs | 67 | 132µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 132µs making 67 calls to vars::CORE:match, avg 2µs/call |
16 | 67 | 153µs | 67 | 31µs | if ($sym =~ /\W/) { # spent 31µs making 67 calls to vars::CORE:match, avg 463ns/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 | 67 | 165µs | 67 | 19µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 19µs making 67 calls to vars::CORE:match, avg 284ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 67 | 159µ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 |