| File | /usr/lib/perl5/5.10.1/vars.pm |
| Statements Executed | 1919 |
| Statement Execution Time | 30.2ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 111 | 111 | 94 | 21.8ms | 27.1ms | vars::import |
| 1098 | 3 | 2 | 5.26ms | 5.26ms | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 847µs | 1.20ms | vars::BEGIN@7 |
| 1 | 1 | 1 | 185µs | 185µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 26µs | 79µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 3 | 237µs | 1 | 185µs | # spent 185µs within vars::BEGIN@3 which was called
# once (185µs+0s) by Scalar::Util::BEGIN@10 at line 3 # spent 185µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 3µs | our $VERSION = '1.01'; | ||
| 6 | |||||
| 7 | 3 | 902µs | 2 | 1.55ms | # spent 1.20ms (847µs+352µs) within vars::BEGIN@7 which was called
# once (847µs+352µs) by Scalar::Util::BEGIN@10 at line 7 # spent 1.20ms making 1 call to vars::BEGIN@7
# spent 352µs making 1 call to warnings::register::import |
| 8 | 3 | 1.09ms | 2 | 132µs | # spent 79µs (26+53) within vars::BEGIN@8 which was called
# once (26µs+53µs) by Scalar::Util::BEGIN@10 at line 8 # spent 79µs making 1 call to vars::BEGIN@8
# spent 53µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 27.1ms (21.8+5.26) within vars::import which was called 111 times, avg 244µs/call:
# once (866µs+367µs) by Template::Config::BEGIN@24 at line 24 of Template/Config.pm
# once (1.07ms+53µs) by namespace::clean::BEGIN@12 at line 12 of namespace/clean.pm
# once (730µs+235µs) by HTML::Tagset::BEGIN@39 at line 39 of HTML/Tagset.pm
# once (679µs+93µs) by Pod::Simple::BEGIN@13 at line 13 of Pod/Simple.pm
# once (528µs+228µs) by Getopt::Long::BEGIN@45 at line 45 of Getopt/Long.pm
# once (564µs+142µs) by File::stat::BEGIN@22 at line 22 of File/stat.pm
# once (503µs+55µs) by HTML::Entities::BEGIN@139 at line 139 of HTML/Entities.pm
# once (427µs+128µs) by Data::Dump::BEGIN@16 at line 16 of Data/Dump.pm
# once (444µs+87µs) by Pod::Escapes::BEGIN@23 at line 23 of Pod/Escapes.pm
# once (362µs+156µs) by DBD::Pg::BEGIN@25 at line 25 of DBD/Pg.pm
# once (455µs+43µs) by HTTP::Date::BEGIN@14 at line 14 of HTTP/Date.pm
# once (424µs+61µs) by HTML::Prototype::BEGIN@5 at line 5 of HTML/Prototype.pm
# once (305µs+128µs) by Locale::Maketext::BEGIN@3 at line 3 of Locale/Maketext.pm
# once (355µs+71µs) by Net::Config::BEGIN@10 at line 10 of Net/Config.pm
# once (308µs+96µs) by Pod::Select::BEGIN@13 at line 13 of Pod/Select.pm
# once (378µs+24µs) by Config::YAML::BEGIN@9 at line 9 of Config/YAML.pm
# once (311µs+52µs) by List::MoreUtils::BEGIN@10 at line 10 of List/MoreUtils.pm
# once (240µs+120µs) by Getopt::Long::BEGIN@48 at line 48 of Getopt/Long.pm
# once (282µs+62µs) by List::Util::BEGIN@12 at line 12 of List/Util.pm
# once (293µs+47µs) by HTML::Element::BEGIN@151 at line 151 of HTML/Element.pm
# once (291µs+46µs) by File::Slurp::BEGIN@61 at line 61 of File/Slurp.pm
# once (264µs+70µs) by I18N::LangTags::Detect::BEGIN@8 at line 8 of I18N/LangTags/Detect.pm
# once (274µs+59µs) by version::BEGIN@7 at line 7 of version.pm
# once (257µs+70µs) by Time::HiRes::BEGIN@4 at line 4 of Time/HiRes.pm
# once (220µs+103µs) by Pod::Text::BEGIN@29 at line 29 of Pod/Text.pm
# once (251µs+60µs) by Template::Constants::BEGIN@28 at line 28 of Template/Constants.pm
# once (249µs+57µs) by Pod::Parser::BEGIN@14 at line 14 of Pod/Parser.pm
# once (197µs+108µs) by Crypt::DES::BEGIN@12 at line 12 of Crypt/DES.pm
# once (243µs+62µs) by Getopt::Long::BEGIN@51 at line 51 of Getopt/Long.pm
# once (187µs+105µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (183µs+104µs) by Data::Dump::BEGIN@4 at line 4 of Data/Dump.pm
# once (239µs+47µs) by CGI::Simple::Util::BEGIN@3 at line 3 of CGI/Simple/Util.pm
# once (235µs+47µs) by Try::Tiny::BEGIN@6 at line 6 of Try/Tiny.pm
# once (217µs+63µs) by Carp::Clan::BEGIN@17 at line 17 of Carp/Clan.pm
# once (260µs+19µs) by MIME::Types::BEGIN@7 at line 7 of MIME/Types.pm
# once (221µs+56µs) by HTTP::Status::BEGIN@6 at line 6 of HTTP/Status.pm
# once (221µs+51µs) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (216µs+54µs) by POSIX::SigRt::BEGIN@66 at line 66 of POSIX.pm
# once (221µs+44µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm
# once (225µs+37µs) by Pod::Usage::BEGIN@13 at line 13 of Pod/Usage.pm
# once (221µs+29µs) by HTTP::Message::BEGIN@4 at line 4 of HTTP/Message.pm
# once (206µs+37µs) by Digest::SHA1::BEGIN@4 at line 4 of Digest/SHA1.pm
# once (207µs+31µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (154µs+78µs) by Getopt::Long::BEGIN@26 at line 26 of Getopt/Long.pm
# once (201µs+29µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (181µs+46µs) by Time::Local::BEGIN@9 at line 9 of Time/Local.pm
# once (138µs+74µs) by Cwd::BEGIN@172 at line 172 of Cwd.pm
# once (175µs+27µs) by MIME::Types::BEGIN@137 at line 137 of MIME/Types.pm
# once (165µs+29µs) by Template::Constants::BEGIN@27 at line 27 of Template/Constants.pm
# once (150µs+43µs) by MIME::Base64::BEGIN@4 at line 4 of MIME/Base64.pm
# once (159µs+30µs) by Crypt::Primes::BEGIN@14 at line 14 of Crypt/Primes.pm
# once (162µs+27µs) by Crypt::RSA::Key::Private::BEGIN@13 at line 13 of Crypt/RSA/Key/Private.pm
# once (145µs+41µs) by Digest::BEGIN@4 at line 4 of Digest.pm
# once (148µs+35µs) by Storable::BEGIN@24 at line 24 of Storable.pm
# once (146µs+36µs) by Net::Cmd::BEGIN@13 at line 13 of Net/Cmd.pm
# once (158µs+23µs) by HTML::Entities::BEGIN@140 at line 140 of HTML/Entities.pm
# once (148µs+26µs) by URI::BEGIN@13 at line 13 of URI.pm
# once (140µs+33µs) by Digest::MD5::BEGIN@4 at line 4 of Digest/MD5.pm
# once (149µs+18µs) by Mail::Mailer::smtp::BEGIN@8 at line 8 of Mail/Mailer/smtp.pm
# once (133µs+34µs) by I18N::LangTags::BEGIN@8 at line 8 of I18N/LangTags.pm
# once (142µs+14µs) by HTML::Element::BEGIN@13 at line 13 of HTML/Element.pm
# once (139µs+13µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm
# once (124µs+28µs) by URI::Escape::BEGIN@142 at line 142 of URI/Escape.pm
# once (113µs+36µs) by File::Spec::Functions::BEGIN@6 at line 6 of File/Spec/Functions.pm
# once (71µs+78µs) by Getopt::Long::BEGIN@19 at line 19 of Getopt/Long.pm
# once (129µs+17µs) by Catalyst::Exception::BEGIN@61 at line 61 of Catalyst/Exception.pm
# once (118µs+26µs) by Net::SMTP::BEGIN@12 at line 12 of Net/SMTP.pm
# once (125µs+17µs) by Crypt::RSA::Key::Public::BEGIN@13 at line 13 of Crypt/RSA/Key/Public.pm
# once (106µs+34µs) by Locale::Maketext::BEGIN@12 at line 12 of Locale/Maketext/Guts.pm
# once (109µs+30µs) by IO::Select::BEGIN@11 at line 11 of IO/Select.pm
# once (110µs+28µs) by Devel::GlobalDestruction::BEGIN@8 at line 8 of Devel/GlobalDestruction.pm
# once (122µs+15µs) by Convert::ASCII::Armour::BEGIN@16 at line 16 of Convert/ASCII/Armour.pm
# once (106µs+31µs) by Devel::InnerPackage::BEGIN@5 at line 5 of Devel/InnerPackage.pm
# once (105µs+29µs) by Tie::ToObject::BEGIN@8 at line 8 of Tie/ToObject.pm
# once (118µs+14µs) by MIME::Type::BEGIN@6 at line 6 of MIME/Type.pm
# once (108µs+25µs) by HTML::Parser::BEGIN@10 at line 10 of HTML/Parser.pm
# once (102µs+28µs) by File::Temp::BEGIN@166 at line 166 of File/Temp.pm
# once (103µs+25µs) by HTTP::Headers::BEGIN@6 at line 6 of HTTP/Headers.pm
# once (100µs+25µs) by Tie::EncryptedHash::BEGIN@14 at line 14 of Tie/EncryptedHash.pm
# once (98µs+24µs) by Crypt::Random::BEGIN@13 at line 13 of Crypt/Random.pm
# once (93µs+28µs) by File::Path::BEGIN@19 at line 19 of File/Path.pm
# once (102µs+18µs) by Text::Balanced::BEGIN@11 at line 11 of Text/Balanced.pm
# once (101µs+16µs) by URI::BEGIN@7 at line 7 of URI.pm
# once (82µs+19µs) by B::Deparse::BEGIN@27 at line 27 of B/Deparse.pm
# once (78µs+18µs) by Crypt::RSA::DataFormat::BEGIN@13 at line 13 of Crypt/RSA/DataFormat.pm
# once (71µs+22µs) by HTML::Prototype::Helper::Tag::BEGIN@8 at line 8 of HTML/Prototype/Helper/Tag.pm
# once (74µs+17µs) by Crypt::RSA::Key::Public::SSH::BEGIN@15 at line 15 of Crypt/RSA/Key/Public/SSH.pm
# once (69µs+20µs) by Mail::Util::BEGIN@8 at line 8 of Mail/Util.pm
# once (67µs+21µs) by Epoll::DB::common::BEGIN@8 at line 8 of Epoll/DB/common.pm
# once (68µs+20µs) by CGI::Simple::Cookie::BEGIN@14 at line 14 of CGI/Simple/Cookie.pm
# once (73µs+14µs) by Crypt::DES_EDE3::BEGIN@7 at line 7 of Crypt/DES_EDE3.pm
# once (72µs+14µs) by Pod::InputObjects::BEGIN@14 at line 14 of Pod/InputObjects.pm
# once (68µs+18µs) by Pod::ParseTree::BEGIN@822 at line 822 of Pod/InputObjects.pm
# once (69µs+17µs) by Term::Size::Any::BEGIN@5 at line 5 of Term/Size/Any.pm
# once (72µs+14µs) by Net::Config::BEGIN@115 at line 115 of Net/Config.pm
# once (67µs+16µs) by Mail::Mailer::smtp::pipe::BEGIN@86 at line 86 of Mail/Mailer/smtp.pm
# once (67µs+16µs) by Mail::Mailer::rfc822::BEGIN@8 at line 8 of Mail/Mailer/rfc822.pm
# once (67µs+15µs) by Class::Data::Inheritable::BEGIN@4 at line 4 of Class/Data/Inheritable.pm
# once (64µs+17µs) by Object::Signature::BEGIN@6 at line 6 of Object/Signature.pm
# once (66µs+15µs) by Mail::Mailer::BEGIN@8 at line 8 of Mail/Mailer.pm
# once (67µs+13µs) by Crypt::RSA::Key::Private::SSH::BEGIN@41 at line 41 of Crypt/RSA/Key/Private/SSH.pm
# once (66µs+14µs) by Data::Buffer::BEGIN@6 at line 6 of Data/Buffer.pm
# once (62µs+17µs) by base::BEGIN@4 at line 4 of base.pm
# once (63µs+14µs) by Class::Loader::BEGIN@13 at line 13 of Class/Loader.pm
# once (63µs+14µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm
# once (60µs+13µs) by Crypt::CBC::BEGIN@7 at line 7 of Crypt/CBC.pm
# once (60µs+13µs) by HTML::Tagset::BEGIN@15 at line 15 of HTML/Tagset.pm
# once (36µs+12µs) by SelfLoader::BEGIN@8 at line 8 of SelfLoader.pm
# once (35µs+13µs) by URI::BEGIN@4 at line 4 of URI.pm
# once (35µs+6µs) by URI::Escape::BEGIN@143 at line 143 of URI/Escape.pm
# once (29µs+6µs) by Module::Pluggable::Object::BEGIN@9 at line 9 of Module/Pluggable/Object.pm | ||||
| 11 | 111 | 361µs | my $callpack = caller; | ||
| 12 | 111 | 858µs | my ($pack, @imports) = @_; | ||
| 13 | 111 | 187µs | my ($sym, $ch); | ||
| 14 | 111 | 2.08ms | foreach (@imports) { | ||
| 15 | 366 | 11.1ms | 366 | 3.15ms | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 3.15ms making 366 calls to vars::CORE:match, avg 9µs/call |
| 16 | 366 | 3.81ms | 366 | 1.11ms | if ($sym =~ /\W/) { # spent 1.11ms making 366 calls to vars::CORE:match, avg 3µ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 | 366 | 3.54ms | 366 | 993µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 993µs making 366 calls to vars::CORE:match, avg 3µ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 | 366 | 6.02ms | : 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 | 8µs | 1; | ||
| 47 | __END__ | ||||
| 48 | |||||
| 49 | =head1 NAME | ||||
| 50 | |||||
| 51 | vars - Perl pragma to predeclare global variable names (obsolete) | ||||
| 52 | |||||
| 53 | =head1 SYNOPSIS | ||||
| 54 | |||||
| 55 | use vars qw($frob @mung %seen); | ||||
| 56 | |||||
| 57 | =head1 DESCRIPTION | ||||
| 58 | |||||
| 59 | NOTE: For variables in the current package, the functionality provided | ||||
| 60 | by this pragma has been superseded by C<our> declarations, available | ||||
| 61 | in Perl v5.6.0 or later. See L<perlfunc/our>. | ||||
| 62 | |||||
| 63 | This will predeclare all the variables whose names are | ||||
| 64 | in the list, allowing you to use them under "use strict", and | ||||
| 65 | disabling any typo warnings. | ||||
| 66 | |||||
| 67 | Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and | ||||
| 68 | C<use subs> declarations are not BLOCK-scoped. They are thus effective | ||||
| 69 | for the entire file in which they appear. You may not rescind such | ||||
| 70 | declarations with C<no vars> or C<no subs>. | ||||
| 71 | |||||
| 72 | Packages such as the B<AutoLoader> and B<SelfLoader> that delay | ||||
| 73 | loading of subroutines within packages can create problems with | ||||
| 74 | package lexicals defined using C<my()>. While the B<vars> pragma | ||||
| 75 | cannot duplicate the effect of package lexicals (total transparency | ||||
| 76 | outside of the package), it can act as an acceptable substitute by | ||||
| 77 | pre-declaring global symbols, ensuring their availability to the | ||||
| 78 | later-loaded routines. | ||||
| 79 | |||||
| 80 | See L<perlmodlib/Pragmatic Modules>. | ||||
| 81 | |||||
| 82 | =cut | ||||
# spent 5.26ms within vars::CORE:match which was called 1098 times, avg 5µs/call:
# 366 times (3.15ms+0s) by vars::import at line 15 of vars.pm, avg 9µs/call
# 366 times (1.11ms+0s) by vars::import at line 16 of vars.pm, avg 3µs/call
# 366 times (993µs+0s) by vars::import at line 28 of vars.pm, avg 3µs/call |