Filename | /usr/share/perl/5.14/vars.pm |
Statements | Executed 200 statements in 588µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
10 | 10 | 5 | 254µs | 314µs | import | vars::
114 | 3 | 1 | 59µs | 59µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 11µs | 11µs | BEGIN@3 | vars::
1 | 1 | 1 | 5µs | 49µs | BEGIN@7 | vars::
1 | 1 | 1 | 4µs | 11µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 42µs | 1 | 11µs | # spent 11µs within vars::BEGIN@3 which was called:
# once (11µs+0s) by Getopt::Long::BEGIN@19 at line 3 # spent 11µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 400ns | our $VERSION = '1.02'; | ||
6 | |||||
7 | 2 | 20µs | 2 | 94µs | # spent 49µs (5+44) within vars::BEGIN@7 which was called:
# once (5µs+44µs) by Getopt::Long::BEGIN@19 at line 7 # spent 49µs making 1 call to vars::BEGIN@7
# spent 44µs making 1 call to warnings::register::import |
8 | 2 | 201µs | 2 | 19µs | # spent 11µs (4+7) within vars::BEGIN@8 which was called:
# once (4µs+7µs) by Getopt::Long::BEGIN@19 at line 8 # spent 11µs making 1 call to vars::BEGIN@8
# spent 7µs making 1 call to strict::import |
9 | |||||
10 | # spent 314µs (254+59) within vars::import which was called 10 times, avg 31µs/call:
# once (59µs+12µs) by Getopt::Long::BEGIN@45 at line 45 of Getopt/Long.pm
# once (36µs+8µs) by Getopt::Long::BEGIN@51 at line 51 of Getopt/Long.pm
# once (34µs+8µs) by Getopt::Long::BEGIN@48 at line 48 of Getopt/Long.pm
# once (31µs+8µs) by Clone::BEGIN@6 at line 6 of Clone.pm
# once (26µs+5µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm
# once (21µs+5µs) by Getopt::Long::BEGIN@26 at line 26 of Getopt/Long.pm
# once (15µs+4µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (13µs+3µs) by Getopt::Long::BEGIN@19 at line 19 of Getopt/Long.pm
# once (11µs+3µs) by parent::BEGIN@3 at line 3 of parent.pm
# once (9µs+3µs) by Config::BEGIN@11 at line 11 of Config.pm | ||||
11 | 10 | 4µs | my $callpack = caller; | ||
12 | 10 | 9µs | my (undef, @imports) = @_; | ||
13 | 10 | 2µs | my ($sym, $ch); | ||
14 | 10 | 23µs | foreach (@imports) { | ||
15 | 38 | 119µs | 38 | 41µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 41µs making 38 calls to vars::CORE:match, avg 1µs/call |
16 | 38 | 38µs | 38 | 10µs | if ($sym =~ /\W/) { # spent 10µs making 38 calls to vars::CORE:match, avg 258ns/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 | 38 | 48µs | 38 | 8µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 8µs making 38 calls to vars::CORE:match, avg 216ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 38 | 80µ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 |