Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/5.22.1/vars.pm |
Statements | Executed 172 statements in 871µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
10 | 10 | 10 | 347µs | 441µs | import | vars::
93 | 3 | 1 | 94µs | 94µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 19µs | 19µs | BEGIN@3 | vars::
1 | 1 | 1 | 7µs | 82µs | BEGIN@7 | vars::
1 | 1 | 1 | 7µs | 19µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 65µs | 1 | 19µs | # spent 19µs within vars::BEGIN@3 which was called:
# once (19µs+0s) by version::BEGIN@11 at line 3 # spent 19µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 500ns | our $VERSION = '1.03'; | ||
6 | |||||
7 | 2 | 31µs | 2 | 156µs | # spent 82µs (7+74) within vars::BEGIN@7 which was called:
# once (7µs+74µs) by version::BEGIN@11 at line 7 # spent 82µs making 1 call to vars::BEGIN@7
# spent 74µs making 1 call to warnings::register::import |
8 | 2 | 312µs | 2 | 31µs | # spent 19µs (7+12) within vars::BEGIN@8 which was called:
# once (7µs+12µs) by version::BEGIN@11 at line 8 # spent 19µs making 1 call to vars::BEGIN@8
# spent 12µs making 1 call to strict::import |
9 | |||||
10 | # spent 441µs (347+94) within vars::import which was called 10 times, avg 44µs/call:
# once (66µs+16µs) by version::BEGIN@11 at line 11 of version.pm
# once (54µs+15µs) by DateTime::TimeZone::Catalog::BEGIN@12 at line 12 of DateTime/TimeZone/Catalog.pm
# once (44µs+11µs) by Class::Inspector::BEGIN@50 at line 50 of Class/Inspector.pm
# once (39µs+11µs) by version::regex::BEGIN@5 at line 5 of version/regex.pm
# once (34µs+8µs) by Params::Validate::BEGIN@14 at line 14 of Params/Validate.pm
# once (30µs+11µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (32µs+8µs) by version::vxs::BEGIN@7 at line 7 of version/vxs.pm
# once (18µs+5µs) by base::BEGIN@5 at line 5 of base.pm
# once (15µs+4µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm
# once (14µs+4µs) by parent::BEGIN@3 at line 3 of parent.pm | ||||
11 | 10 | 9µs | my $callpack = caller; | ||
12 | 10 | 17µs | my (undef, @imports) = @_; | ||
13 | 10 | 3µs | my ($sym, $ch); | ||
14 | 10 | 45µs | foreach (@imports) { | ||
15 | 31 | 164µs | 31 | 65µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 65µs making 31 calls to vars::CORE:match, avg 2µs/call |
16 | 31 | 58µs | 31 | 17µs | if ($sym =~ /\W/) { # spent 17µs making 31 calls to vars::CORE:match, avg 558ns/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 | 31 | 67µs | 31 | 12µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 12µs making 31 calls to vars::CORE:match, avg 374ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 31 | 97µ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 |