← Index
NYTProf Performance Profile   « block view • line view • sub view »
For ddd2.pl
  Run on Tue May 25 16:52:24 2010
Reported on Tue May 25 16:56:47 2010

File /usr/local/lib/perl5/5.8.8/vars.pm
Statements Executed 695
Statement Execution Time 14.4ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
45453910.1ms12.6msvars::::importvars::import
378322.52ms2.52msvars::::CORE:matchvars::CORE:match (opcode)
0000s0svars::::BEGINvars::BEGIN
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package vars;
2
33101µsuse 5.006;
4
516µsour $VERSION = '1.01';
6
73737µs1650µsuse warnings::register;
# spent 650µs making 1 call to warnings::register::import
83702µs1167µsuse strict qw(vars subs);
# spent 167µs making 1 call to strict::import
9
10
# spent 12.6ms (10.1+2.51) within vars::import which was called 45 times, avg 280µs/call: # once (1.01ms+263µs) by Class::DBI::_require_class at line 7 of Class/Date.pm # once (587µs+155µs) by DBI::install_driver at line 25 of DBD/Pg.pm # once (351µs+116µs) by base::import at line 12 of List/Util.pm # once (335µs+86µs) by base::import at line 6 of Clone.pm # once (320µs+93µs) by URI::BEGIN at line 13 of URI.pm # once (321µs+76µs) by HTTP::Status::BEGIN at line 8 of HTTP/Status.pm # once (295µs+95µs) by Class::DBI::_require_class at line 9 of Time/Local.pm # once (317µs+73µs) by Class::DBI::_require_class at line 4 of Class/Date/Const.pm # once (309µs+76µs) by URI::Escape::BEGIN at line 145 of URI/Escape.pm # once (305µs+75µs) by base::import at line 16 of DBI/Const/GetInfoType.pm # once (300µs+77µs) by LWP::UserAgent::get at line 6 of HTTP/Request/Common.pm # once (294µs+74µs) by base::import at line 10 of Scalar/Util.pm # once (294µs+68µs) by LWP::Protocol::collect at line 134 of HTML/Entities.pm # once (281µs+74µs) by base::import at line 7 of version.pm # once (259µs+55µs) by HTTP::Date::BEGIN at line 14 of HTTP/Date.pm # once (225µs+53µs) by base::import at line 8 of version/vxs.pm # once (219µs+57µs) by base::import at line 24 of Storable.pm # once (199µs+41µs) by LWP::Protocol::collect at line 10 of HTML/Parser.pm # once (194µs+42µs) by base::import at line 18 of DynaLoader.pm # once (184µs+43µs) by HTTP::Headers::BEGIN at line 8 of HTTP/Headers.pm # once (180µs+45µs) by base::import at line 4 of Class/DBI/AbstractSearch.pm # once (167µs+58µs) by URI::BEGIN at line 7 of URI.pm # once (179µs+43µs) by HTTP::Message::BEGIN at line 6 of HTTP/Message.pm # once (171µs+48µs) by LWP::Protocol::implementor at line 13 of LWP/Protocol/http.pm # once (171µs+46µs) by base::import at line 4 of File/Spec.pm # once (178µs+37µs) by LWP::Protocol::collect at line 135 of HTML/Entities.pm # once (170µs+44µs) by IO::Socket::connect at line 11 of IO/Select.pm # once (170µs+41µs) by LWP::UserAgent::BEGIN at line 6 of LWP/UserAgent.pm # once (166µs+44µs) by LWP::Protocol::collect at line 77 of HTML/HeadParser.pm # once (168µs+39µs) by LWP::Protocol::implementor at line 6 of Net/HTTP.pm # once (128µs+30µs) by base::BEGIN at line 4 of base.pm # once (132µs+25µs) by base::import at line 7 of Data/Page.pm # once (132µs+24µs) by LWP::Protocol::implementor at line 8 of Net/HTTP/Methods.pm # once (124µs+25µs) by LWP::Protocol::implementor at line 416 of LWP/Protocol/http.pm # once (121µs+28µs) by WWW::Google::PageRank::BEGIN at line 8 of WWW/Google/PageRank.pm # once (118µs+25µs) by URI::BEGIN at line 4 of URI.pm # once (116µs+27µs) by base::import at line 24 of Class/DBI.pm # once (116µs+25µs) by base::import at line 11 of Class/DBI/Plugin/Pager.pm # once (115µs+26µs) by base::import at line 6 of Class/DBI/Pg.pm # once (115µs+25µs) by Class::DBI::_require_class at line 588 of Class/Date.pm # once (110µs+27µs) by base::import at line 4 of Class/Trigger.pm # once (113µs+24µs) by base::import at line 4 of Class/Data/Inheritable.pm # once (112µs+22µs) by base::import at line 4 of File/Spec/Unix.pm # once (110µs+21µs) by URI::Escape::BEGIN at line 146 of URI/Escape.pm # once (106µs+24µs) by base::import at line 13 of UNIVERSAL/require.pm
sub import {
1168412.9ms my $callpack = caller;
12 my ($pack, @imports) = @_;
13 my ($sym, $ch);
14 foreach (@imports) {
15 if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
# spent 1.16ms making 126 calls to vars::CORE:match, avg 9µs/call
16 if ($sym =~ /\W/) {
# spent 719µs making 126 calls to vars::CORE:match, avg 6µ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 $sym = "${callpack}::$sym" unless $sym =~ /::/;
# spent 637µs making 126 calls to vars::CORE:match, avg 5µ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 : 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
46113µs1;
47__END__
48
49=head1 NAME
50
51vars - 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
59NOTE: For variables in the current package, the functionality provided
60by this pragma has been superseded by C<our> declarations, available
61in Perl v5.6.0 or later. See L<perlfunc/our>.
62
63This will predeclare all the variables whose names are
64in the list, allowing you to use them under "use strict", and
65disabling any typo warnings.
66
67Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and
68C<use subs> declarations are not BLOCK-scoped. They are thus effective
69for the entire file in which they appear. You may not rescind such
70declarations with C<no vars> or C<no subs>.
71
72Packages such as the B<AutoLoader> and B<SelfLoader> that delay
73loading of subroutines within packages can create problems with
74package lexicals defined using C<my()>. While the B<vars> pragma
75cannot duplicate the effect of package lexicals (total transparency
76outside of the package), it can act as an acceptable substitute by
77pre-declaring global symbols, ensuring their availability to the
78later-loaded routines.
79
80See L<perlmodlib/Pragmatic Modules>.
81
82=cut
# spent 2.52ms within vars::CORE:match which was called 378 times, avg 7µs/call: # 126 times (1.16ms+0s) by vars::import at line 15 of vars.pm, avg 9µs/call # 126 times (719µs+0s) by vars::import at line 16 of vars.pm, avg 6µs/call # 126 times (637µs+0s) by vars::import at line 28 of vars.pm, avg 5µs/call
sub vars::CORE:match; # xsub