Filename | /usr/share/perl/5.28/vars.pm |
Statements | Executed 528 statements in 1.45ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
21 | 21 | 13 | 849µs | 1.03ms | import | vars::
327 | 3 | 1 | 183µs | 183µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 22µs | 22µs | BEGIN@3 | vars::
1 | 1 | 1 | 8µs | 47µs | BEGIN@7 | vars::
1 | 1 | 1 | 4µs | 17µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 58µs | 1 | 22µs | # spent 22µs within vars::BEGIN@3 which was called:
# once (22µs+0s) by parent::BEGIN@3 at line 3 # spent 22µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 500ns | our $VERSION = '1.04'; | ||
6 | |||||
7 | 2 | 28µs | 2 | 86µs | # spent 47µs (8+39) within vars::BEGIN@7 which was called:
# once (8µs+39µs) by parent::BEGIN@3 at line 7 # spent 47µs making 1 call to vars::BEGIN@7
# spent 39µs making 1 call to warnings::register::import |
8 | 2 | 306µs | 2 | 29µs | # spent 17µs (4+12) within vars::BEGIN@8 which was called:
# once (4µs+12µs) by parent::BEGIN@3 at line 8 # spent 17µs making 1 call to vars::BEGIN@8
# spent 12µs making 1 call to strict::import |
9 | |||||
10 | # spent 1.03ms (849µs+183µs) within vars::import which was called 21 times, avg 49µs/call:
# once (119µs+24µs) by File::Copy::Recursive::BEGIN@16 at line 16 of File/Copy/Recursive.pm
# once (108µs+24µs) by Template::Config::BEGIN@24 at line 24 of Template/Config.pm
# once (55µs+11µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm
# once (51µs+11µs) by Data::Dump::BEGIN@16 at line 16 of Data/Dump.pm
# once (45µs+8µs) by File::Path::BEGIN@20 at line 20 of File/Path.pm
# once (42µs+10µs) by Digest::SHA::BEGIN@7 at line 7 of Digest/SHA.pm
# once (40µs+9µs) by IO::CaptureOutput::BEGIN@9 at line 9 of IO/CaptureOutput.pm
# once (40µs+8µs) by File::Temp::BEGIN@36 at line 36 of File/Temp.pm
# once (39µs+8µs) by Template::Constants::BEGIN@28 at line 28 of Template/Constants.pm
# once (37µs+7µs) by Getopt::Long::BEGIN@52 at line 52 of Getopt/Long.pm
# once (36µs+6µs) by Getopt::Long::BEGIN@49 at line 49 of Getopt/Long.pm
# once (33µs+8µs) by String::ShellQuote::BEGIN@29 at line 29 of String/ShellQuote.pm
# once (31µs+8µs) by Data::Dump::BEGIN@4 at line 4 of Data/Dump.pm
# once (31µs+5µs) by Getopt::Long::BEGIN@47 at line 47 of Getopt/Long.pm
# once (27µs+7µs) by Digest::MD5::BEGIN@4 at line 4 of Digest/MD5.pm
# once (27µs+7µs) by Template::Constants::BEGIN@27 at line 27 of Template/Constants.pm
# once (23µs+6µs) by Getopt::Long::BEGIN@20 at line 20 of Getopt/Long.pm
# once (23µs+5µs) by Getopt::Long::BEGIN@27 at line 27 of Getopt/Long.pm
# once (17µs+4µs) by parent::BEGIN@3 at line 3 of parent.pm
# once (14µs+5µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm
# once (10µs+2µs) by Getopt::Long::BEGIN@23 at line 23 of Getopt/Long.pm | ||||
11 | 21 | 15µs | my $callpack = caller; | ||
12 | 21 | 29µs | my (undef, @imports) = @_; | ||
13 | 21 | 6µs | my ($sym, $ch); | ||
14 | 21 | 77µs | foreach (@imports) { | ||
15 | 109 | 341µs | 109 | 125µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 125µs making 109 calls to vars::CORE:match, avg 1µs/call |
16 | 109 | 141µs | 109 | 31µs | if ($sym =~ /\W/) { # spent 31µs making 109 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 | 109 | 161µs | 109 | 26µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 26µs making 109 calls to vars::CORE:match, avg 240ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 109 | 288µ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 |