Filename | /usr/share/perl/5.28/vars.pm |
Statements | Executed 528 statements in 1.46ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
21 | 21 | 13 | 833µs | 1.04ms | import | vars::
327 | 3 | 1 | 206µs | 206µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 21µs | 21µs | BEGIN@3 | vars::
1 | 1 | 1 | 7µs | 43µs | BEGIN@7 | vars::
1 | 1 | 1 | 5µs | 16µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 63µs | 1 | 21µs | # spent 21µs within vars::BEGIN@3 which was called:
# once (21µs+0s) by parent::BEGIN@3 at line 3 # spent 21µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 300ns | our $VERSION = '1.04'; | ||
6 | |||||
7 | 2 | 28µs | 2 | 78µs | # spent 43µs (7+36) within vars::BEGIN@7 which was called:
# once (7µs+36µs) by parent::BEGIN@3 at line 7 # spent 43µs making 1 call to vars::BEGIN@7
# spent 36µs making 1 call to warnings::register::import |
8 | 2 | 295µs | 2 | 28µs | # spent 16µs (5+12) within vars::BEGIN@8 which was called:
# once (5µs+12µs) by parent::BEGIN@3 at line 8 # spent 16µs making 1 call to vars::BEGIN@8
# spent 12µs making 1 call to strict::import |
9 | |||||
10 | # spent 1.04ms (833µs+206µs) within vars::import which was called 21 times, avg 49µs/call:
# once (122µs+46µs) by File::Copy::Recursive::BEGIN@16 at line 16 of File/Copy/Recursive.pm
# once (102µs+20µs) by Template::Config::BEGIN@24 at line 24 of Template/Config.pm
# once (57µs+12µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm
# once (48µs+11µs) by Data::Dump::BEGIN@16 at line 16 of Data/Dump.pm
# once (41µs+11µ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 (40µs+8µs) by Getopt::Long::BEGIN@49 at line 49 of Getopt/Long.pm
# once (37µs+9µs) by Digest::SHA::BEGIN@7 at line 7 of Digest/SHA.pm
# once (36µs+8µs) by File::Path::BEGIN@20 at line 20 of File/Path.pm
# once (37µs+7µs) by Template::Constants::BEGIN@28 at line 28 of Template/Constants.pm
# once (33µs+9µs) by String::ShellQuote::BEGIN@29 at line 29 of String/ShellQuote.pm
# once (34µs+7µs) by Getopt::Long::BEGIN@52 at line 52 of Getopt/Long.pm
# once (32µs+9µs) by Digest::MD5::BEGIN@4 at line 4 of Digest/MD5.pm
# once (32µs+5µs) by Getopt::Long::BEGIN@47 at line 47 of Getopt/Long.pm
# once (28µs+7µs) by Data::Dump::BEGIN@4 at line 4 of Data/Dump.pm
# once (26µs+6µs) by Template::Constants::BEGIN@27 at line 27 of Template/Constants.pm
# once (22µs+7µ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+5µs) by parent::BEGIN@3 at line 3 of parent.pm
# once (14µs+4µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm
# once (11µs+2µs) by Getopt::Long::BEGIN@23 at line 23 of Getopt/Long.pm | ||||
11 | 21 | 16µs | my $callpack = caller; | ||
12 | 21 | 29µs | my (undef, @imports) = @_; | ||
13 | 21 | 6µs | my ($sym, $ch); | ||
14 | 21 | 76µs | foreach (@imports) { | ||
15 | 109 | 358µs | 109 | 146µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 146µs making 109 calls to vars::CORE:match, avg 1µs/call |
16 | 109 | 140µs | 109 | 34µs | if ($sym =~ /\W/) { # spent 34µs making 109 calls to vars::CORE:match, avg 308ns/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 | 165µ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 | 276µ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 |