← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:51 2015

Filename/usr/share/perl/5.20/deprecate.pm
StatementsExecuted 62 statements in 610µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
311119µs203µsdeprecate::::__loaded_from_coredeprecate::__loaded_from_core
152160µs60µsdeprecate::::CORE:substdeprecate::CORE:subst (opcode)
31128µs236µsdeprecate::::importdeprecate::import
11112µs27µsdeprecate::::BEGIN@2deprecate::BEGIN@2
1118µs13µsdeprecate::::BEGIN@3deprecate::BEGIN@3
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package deprecate;
2223µs242µs
# spent 27µs (12+15) within deprecate::BEGIN@2 which was called: # once (12µs+15µs) by if::work at line 2
use strict;
# spent 27µs making 1 call to deprecate::BEGIN@2 # spent 15µs making 1 call to strict::import
32369µs219µs
# spent 13µs (8+6) within deprecate::BEGIN@3 which was called: # once (8µs+6µs) by if::work at line 3
use warnings;
# spent 13µs making 1 call to deprecate::BEGIN@3 # spent 6µs making 1 call to warnings::import
41300nsour $VERSION = 0.03;
5
6# our %Config can ignore %Config::Config, e.g. for testing
71100nsour %Config;
832µsunless (%Config) { require Config; *Config = \%Config::Config; }
9
10# Debian-specific change: recommend the separate Debian packages of
11# deprecated modules where available
12
1317µsour %DEBIAN_PACKAGES = (
14 'CGI' => 'libcgi-pm-perl',
15 'CGI::Apache' => 'libcgi-pm-perl',
16 'CGI::Carp' => 'libcgi-pm-perl',
17 'CGI::Cookie' => 'libcgi-pm-perl',
18 'CGI::Fast' => 'libcgi-fast-perl',
19 'CGI::Pretty' => 'libcgi-pm-perl',
20 'CGI::Push' => 'libcgi-pm-perl',
21 'CGI::Switch' => 'libcgi-pm-perl',
22 'CGI::Util' => 'libcgi-pm-perl',
23 'Module::Build' => 'libmodule-build-perl',
24 'Package::Constants' => 'libpackage-constants-perl',
25);
26
27# This isn't a public API. It's internal to code maintained by the perl-porters
28# If you would like it to be a public API, please send a patch with
29# documentation and tests. Until then, it may change without warning.
30
# spent 203µs (119+84) within deprecate::__loaded_from_core which was called 3 times, avg 68µs/call: # 3 times (119µs+84µs) by deprecate::import at line 56, avg 68µs/call
sub __loaded_from_core {
3132µs my ($package, $file, $expect_leaf) = @_;
32
3339µs foreach my $pair ([qw(sitearchexp archlibexp)],
34 [qw(sitelibexp privlibexp)]) {
35645µs1229µs my ($site, $priv) = @Config{@$pair};
# spent 29µs making 12 calls to Config::FETCH, avg 2µs/call
3665µs if ($^O eq 'VMS') {
37 for my $d ($site, $priv) { $d = VMS::Filespec::unixify($d) };
38 }
39 # Just in case anyone managed to configure with trailing /s
40686µs1255µs s!/*$!!g foreach $site, $priv;
# spent 55µs making 12 calls to deprecate::CORE:subst, avg 5µs/call
41
4262µs next if $site eq $priv;
43611µs if (uc("$priv/$expect_leaf") eq uc($file)) {
44 return 1;
45 }
46 }
4738µs return 0;
48}
49
50
# spent 236µs (28+208) within deprecate::import which was called 3 times, avg 79µs/call: # 3 times (28µs+208µs) by CGI::BEGIN@3 or CGI::Cookie::BEGIN@6 or CGI::Util::BEGIN@5 at line 15 of if.pm, avg 79µs/call
sub import {
5136µs my ($package, $file) = caller;
52
5333µs my $expect_leaf = "$package.pm";
54314µs35µs $expect_leaf =~ s!::!/!g;
# spent 5µs making 3 calls to deprecate::CORE:subst, avg 2µs/call
55
56314µs3203µs if (__loaded_from_core($package, $file, $expect_leaf)) {
# spent 203µs making 3 calls to deprecate::__loaded_from_core, avg 68µs/call
57 my $call_depth=1;
58 my @caller;
59 while (@caller = caller $call_depth++) {
60 last if $caller[7] # use/require
61 and $caller[6] eq $expect_leaf; # the package file
62 }
63 unless (@caller) {
64 require Carp;
65 Carp::cluck(<<"EOM");
66Can't find use/require $expect_leaf in caller stack
67EOM
68 return;
69 }
70
71 # This is fragile, because it
72 # is directly poking in the internals of warnings.pm
73 my ($call_file, $call_line, $callers_bitmask) = @caller[1,2,9];
74
75 if (defined $callers_bitmask
76 && (vec($callers_bitmask, $warnings::Offsets{deprecated}, 1)
77 || vec($callers_bitmask, $warnings::Offsets{all}, 1))) {
78 if (my $deb = $DEBIAN_PACKAGES{$package}) {
79 warn <<"EOM";
80$package will be removed from the Perl core distribution in the next major release. Please install the separate $deb package. It is being used at $call_file, line $call_line.
81EOM
82 } else {
83 warn <<"EOM";
84$package will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at $call_file, line $call_line.
85EOM
86 }
87 }
88 }
89}
90
9114µs1;
92
93__END__
 
# spent 60µs within deprecate::CORE:subst which was called 15 times, avg 4µs/call: # 12 times (55µs+0s) by deprecate::__loaded_from_core at line 40, avg 5µs/call # 3 times (5µs+0s) by deprecate::import at line 54, avg 2µs/call
sub deprecate::CORE:subst; # opcode