Filename | /usr/share/perl/5.10/vars.pm |
Statements | Executed 291 statements in 2.50ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
24 | 24 | 19 | 1.32ms | 1.62ms | import | vars::
1 | 1 | 1 | 340µs | 511µs | BEGIN@7 | vars::
138 | 3 | 1 | 301µs | 301µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 56µs | 56µs | BEGIN@3 | vars::
1 | 1 | 1 | 14µs | 42µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 3 | 92µs | 1 | 56µs | # spent 56µs within vars::BEGIN@3 which was called:
# once (56µs+0s) by MARC::File::XML::BEGIN@5 at line 3 # spent 56µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 1µs | our $VERSION = '1.01'; | ||
6 | |||||
7 | 3 | 365µs | 2 | 682µs | # spent 511µs (340+171) within vars::BEGIN@7 which was called:
# once (340µs+171µs) by MARC::File::XML::BEGIN@5 at line 7 # spent 511µs making 1 call to vars::BEGIN@7
# spent 171µs making 1 call to warnings::register::import |
8 | 3 | 371µs | 2 | 70µs | # spent 42µs (14+28) within vars::BEGIN@8 which was called:
# once (14µs+28µs) by MARC::File::XML::BEGIN@5 at line 8 # spent 42µs making 1 call to vars::BEGIN@8
# spent 28µs making 1 call to strict::import |
9 | |||||
10 | # spent 1.62ms (1.32+301µs) within vars::import which was called 24 times, avg 68µs/call:
# once (158µs+33µs) by XML::Parser::Expat::BEGIN@6 at line 6 of XML/Parser/Expat.pm
# once (121µs+31µs) by POSIX::SigRt::BEGIN@66 at line 66 of POSIX.pm
# once (77µs+20µs) by XML::NamespaceSupport::BEGIN@18 at line 18 of XML/NamespaceSupport.pm
# once (76µs+19µs) by XML::SAX::BEGIN@6 at line 6 of XML/SAX.pm
# once (73µs+19µs) by Storable::BEGIN@24 at line 24 of Storable.pm
# once (71µs+19µs) by MARC::Record::BEGIN@27 at line 27 of MARC/Record.pm
# once (68µs+15µs) by MARC::File::XML::BEGIN@5 at line 5 of MARC/File/XML.pm
# once (57µs+13µs) by XML::SAX::Exception::BEGIN@8 at line 8 of XML/SAX/Exception.pm
# once (55µs+12µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (54µs+13µs) by XML::Parser::BEGIN@22 at line 22 of XML/Parser.pm
# once (53µs+12µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (54µs+9µs) by MARC::File::USMARC::BEGIN@12 at line 12 of MARC/File/USMARC.pm
# once (38µs+9µs) by XML::Parser::ExpatNB::BEGIN@587 at line 587 of XML/Parser/Expat.pm
# once (38µs+7µs) by MARC::File::USMARC::BEGIN@16 at line 16 of MARC/File/USMARC.pm
# once (36µs+7µs) by XML::SAX::ParserFactory::BEGIN@6 at line 6 of XML/SAX/ParserFactory.pm
# once (34µs+8µs) by XML::SAX::Expat::BEGIN@13 at line 13 of XML/SAX/Expat.pm
# once (35µs+7µs) by XML::SAX::Base::BEGIN@29 at line 29 of XML/SAX/Base.pm
# once (33µs+7µs) by MARC::Field::BEGIN@10 at line 10 of MARC/Field.pm
# once (33µs+7µs) by MARC::Record::BEGIN@23 at line 23 of MARC/Record.pm
# once (31µs+8µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm
# once (32µs+7µs) by MARC::Record::BEGIN@12 at line 12 of MARC/Record.pm
# once (31µs+6µs) by base::BEGIN@4 at line 4 of base.pm
# once (30µs+7µs) by MARC::Record::BEGIN@32 at line 32 of MARC/Record.pm
# once (31µs+6µs) by MARC::File::BEGIN@12 at line 12 of MARC/File.pm | ||||
11 | 24 | 45µs | my $callpack = caller; | ||
12 | 24 | 61µs | my ($pack, @imports) = @_; | ||
13 | 24 | 27µs | my ($sym, $ch); | ||
14 | 24 | 176µs | foreach (@imports) { | ||
15 | 46 | 584µs | 46 | 164µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 164µs making 46 calls to vars::CORE:match, avg 4µs/call |
16 | 46 | 237µs | 46 | 74µs | if ($sym =~ /\W/) { # spent 74µs making 46 calls to vars::CORE:match, avg 2µs/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 | 46 | 246µs | 46 | 63µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 63µs making 46 calls to vars::CORE:match, avg 1µs/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 46 | 292µ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 | 4µs | 1; | ||
47 | __END__ | ||||
sub vars::CORE:match; # opcode |