| Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/5.38.2/vars.pm |
| Statements | Executed 324 statements in 874µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 24 | 24 | 16 | 357µs | 440µs | vars::import |
| 1 | 1 | 1 | 14µs | 14µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 4µs | 19µs | vars::BEGIN@7 |
| 1 | 1 | 1 | 4µs | 8µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 2 | 53µs | 1 | 14µs | # spent 14µs within vars::BEGIN@3 which was called:
# once (14µs+0s) by Test2::EventFacet::Meta::BEGIN@8 at line 3 # spent 14µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 400ns | our $VERSION = '1.05'; | ||
| 6 | |||||
| 7 | 2 | 16µs | 2 | 34µs | # spent 19µs (4+15) within vars::BEGIN@7 which was called:
# once (4µs+15µs) by Test2::EventFacet::Meta::BEGIN@8 at line 7 # spent 19µs making 1 call to vars::BEGIN@7
# spent 15µs making 1 call to warnings::register::import |
| 8 | 2 | 337µs | 2 | 11µs | # spent 8µs (4+4) within vars::BEGIN@8 which was called:
# once (4µs+4µs) by Test2::EventFacet::Meta::BEGIN@8 at line 8 # spent 8µs making 1 call to vars::BEGIN@8
# spent 4µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 440µs (357+83) within vars::import which was called 24 times, avg 18µs/call:
# once (24µs+5µs) by Digest::Perl::MD5::BEGIN@5 at line 5 of Digest/Perl/MD5.pm
# once (22µs+5µs) by File::Path::BEGIN@20 at line 20 of File/Path.pm
# once (22µs+5µs) by Digest::SHA::BEGIN@7 at line 7 of Digest/SHA.pm
# once (20µs+5µs) by XML::Twig::BEGIN@27 at line 27 of XML/Twig.pm
# once (19µs+5µs) by Crypt::RC4::BEGIN@16 at line 16 of Crypt/RC4.pm
# once (17µs+4µs) by OLE::Storage_Lite::PPS::BEGIN@13 at line 13 of OLE/Storage_Lite.pm
# once (16µs+3µs) by Test2::EventFacet::Meta::BEGIN@8 at line 8 of Test2/EventFacet/Meta.pm
# once (14µs+4µs) by Archive::Zip::FileMember::BEGIN@4 at line 4 of Archive/Zip/FileMember.pm
# once (14µs+3µs) by OLE::Storage_Lite::BEGIN@834 at line 834 of OLE/Storage_Lite.pm
# once (14µs+4µs) by Archive::Zip::Member::BEGIN@6 at line 6 of Archive/Zip/Member.pm
# once (14µs+3µs) by Archive::Zip::NewFileMember::BEGIN@4 at line 4 of Archive/Zip/NewFileMember.pm
# once (14µs+3µs) by Archive::Zip::StringMember::BEGIN@4 at line 4 of Archive/Zip/StringMember.pm
# once (14µs+3µs) by Archive::Zip::ZipFileMember::BEGIN@4 at line 4 of Archive/Zip/ZipFileMember.pm
# once (14µs+3µs) by OLE::Storage_Lite::PPS::File::BEGIN@714 at line 714 of OLE/Storage_Lite.pm
# once (14µs+3µs) by Spreadsheet::ParseExcel::Utility::BEGIN@23 at line 23 of Spreadsheet/ParseExcel/Utility.pm
# once (13µs+3µs) by Archive::Zip::BEGIN@14 at line 14 of Archive/Zip.pm
# once (13µs+3µs) by Archive::Zip::DirectoryMember::BEGIN@6 at line 6 of Archive/Zip/DirectoryMember.pm
# once (13µs+3µs) by OLE::Storage_Lite::PPS::Dir::BEGIN@802 at line 802 of OLE/Storage_Lite.pm
# once (13µs+3µs) by Archive::Zip::Archive::BEGIN@14 at line 14 of Archive/Zip/Archive.pm
# once (13µs+3µs) by OLE::Storage_Lite::PPS::Root::BEGIN@172 at line 172 of OLE/Storage_Lite.pm
# once (11µs+2µs) by Archive::Zip::BEGIN@35 at line 35 of Archive/Zip.pm
# once (10µs+3µs) by XML::Twig::BEGIN@439 at line 439 of XML/Twig.pm
# once (11µs+2µs) by Archive::Zip::BEGIN@23 at line 23 of Archive/Zip.pm
# once (7µs+2µs) by XML::Twig::BEGIN@38 at line 38 of XML/Twig.pm | ||||
| 11 | 24 | 10µs | my $callpack = caller; | ||
| 12 | 24 | 19µs | my (undef, @imports) = @_; | ||
| 13 | 24 | 4µs | my ($sym, $ch); | ||
| 14 | 24 | 52µs | foreach (@imports) { | ||
| 15 | 55 | 155µs | 55 | 58µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 58µs making 55 calls to CORE::match, avg 1µs/call |
| 16 | 55 | 51µs | 55 | 14µs | if ($sym =~ /\W/) { # spent 14µs making 55 calls to CORE::match, avg 251ns/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 | 55 | 63µs | 55 | 12µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 12µs making 55 calls to CORE::match, avg 209ns/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 55 | 110µ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__ |