← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:42:38 2010
Reported on Wed Nov 17 22:04:42 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Package/DeprecationManager.pm
StatementsExecuted 117 statements in 5.42ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1119.89ms22.5msPackage::DeprecationManager::::BEGIN@10Package::DeprecationManager::BEGIN@10
1119.26ms11.9msPackage::DeprecationManager::::BEGIN@11Package::DeprecationManager::BEGIN@11
1114.73ms6.04msPackage::DeprecationManager::::BEGIN@12Package::DeprecationManager::BEGIN@12
8881.46ms1.46msPackage::DeprecationManager::::__ANON__[:61]Package::DeprecationManager::__ANON__[:61]
333682µs2.84msPackage::DeprecationManager::::importPackage::DeprecationManager::import
311154µs154µsPackage::DeprecationManager::::_build_warnPackage::DeprecationManager::_build_warn
31177µs77µsPackage::DeprecationManager::::_build_importPackage::DeprecationManager::_build_import
11163µs63µsPackage::DeprecationManager::::BEGIN@2Package::DeprecationManager::BEGIN@2
11137µs113µsPackage::DeprecationManager::::BEGIN@7Package::DeprecationManager::BEGIN@7
11136µs52µsPackage::DeprecationManager::::BEGIN@6Package::DeprecationManager::BEGIN@6
11135µs186µsPackage::DeprecationManager::::BEGIN@9Package::DeprecationManager::BEGIN@9
0000s0sPackage::DeprecationManager::::__ANON__[:123]Package::DeprecationManager::__ANON__[:123]
0000s0sPackage::DeprecationManager::::__ANON__[:83]Package::DeprecationManager::__ANON__[:83]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Package::DeprecationManager;
2
# spent 63µs within Package::DeprecationManager::BEGIN@2 which was called: # once (63µs+0s) by Moose::Deprecated::BEGIN@10 at line 4
BEGIN {
3137µs $Package::DeprecationManager::VERSION = '0.10';
4172µs163µs}
# spent 63µs making 1 call to Package::DeprecationManager::BEGIN@2
5
6388µs268µs
# spent 52µs (36+16) within Package::DeprecationManager::BEGIN@6 which was called: # once (36µs+16µs) by Moose::Deprecated::BEGIN@10 at line 6
use strict;
# spent 52µs making 1 call to Package::DeprecationManager::BEGIN@6 # spent 16µs making 1 call to strict::import
73110µs2188µs
# spent 113µs (37+76) within Package::DeprecationManager::BEGIN@7 which was called: # once (37µs+76µs) by Moose::Deprecated::BEGIN@10 at line 7
use warnings;
# spent 113µs making 1 call to Package::DeprecationManager::BEGIN@7 # spent 76µs making 1 call to warnings::import
8
93103µs2337µs
# spent 186µs (35+151) within Package::DeprecationManager::BEGIN@9 which was called: # once (35µs+151µs) by Moose::Deprecated::BEGIN@10 at line 9
use Carp qw( croak );
# spent 186µs making 1 call to Package::DeprecationManager::BEGIN@9 # spent 151µs making 1 call to Exporter::import
103657µs223.0ms
# spent 22.5ms (9.89+12.6) within Package::DeprecationManager::BEGIN@10 which was called: # once (9.89ms+12.6ms) by Moose::Deprecated::BEGIN@10 at line 10
use List::MoreUtils qw( any );
# spent 22.5ms making 1 call to Package::DeprecationManager::BEGIN@10 # spent 544µs making 1 call to Exporter::import
113633µs212.4ms
# spent 11.9ms (9.26+2.67) within Package::DeprecationManager::BEGIN@11 which was called: # once (9.26ms+2.67ms) by Moose::Deprecated::BEGIN@10 at line 11
use Params::Util qw( _HASH );
# spent 11.9ms making 1 call to Package::DeprecationManager::BEGIN@11 # spent 503µs making 1 call to Exporter::import
1232.34ms26.06ms
# spent 6.04ms (4.73+1.32) within Package::DeprecationManager::BEGIN@12 which was called: # once (4.73ms+1.32ms) by Moose::Deprecated::BEGIN@10 at line 12
use Sub::Install;
# spent 6.04ms making 1 call to Package::DeprecationManager::BEGIN@12 # spent 21µs making 1 call to Sub::Install::__ANON__[Sub/Install.pm:284]
13
14
# spent 2.84ms (682µs+2.16) within Package::DeprecationManager::import which was called 3 times, avg 948µs/call: # once (325µs+842µs) by Package::Stash::BEGIN@48 at line 48 of Package/Stash.pm # once (206µs+807µs) by Class::MOP::Deprecated::BEGIN@10 at line 10 of Class/MOP/Deprecated.pm # once (151µs+512µs) by Moose::Deprecated::BEGIN@10 at line 10 of Moose/Deprecated.pm
sub import {
1530680µs shift;
16 my %args = @_;
17
18326µs croak
# spent 26µs making 3 calls to Params::Util::_HASH, avg 9µs/call
19 'You must provide a hash reference -deprecations parameter when importing Package::DeprecationManager'
20 unless $args{-deprecations} && _HASH( $args{-deprecations} );
21
22 my %registry;
23
24377µs my $import = _build_import( \%registry );
# spent 77µs making 3 calls to Package::DeprecationManager::_build_import, avg 26µs/call
253154µs my $warn = _build_warn( \%registry, $args{-deprecations}, $args{-ignore} );
# spent 154µs making 3 calls to Package::DeprecationManager::_build_warn, avg 51µs/call
26
27 my $caller = caller();
28
2931.02ms Sub::Install::install_sub(
# spent 1.02ms making 3 calls to Sub::Install::__ANON__[Sub/Install.pm:132], avg 341µs/call
30 {
31 code => $import,
32 into => $caller,
33 as => 'import',
34 }
35 );
36
373883µs Sub::Install::install_sub(
# spent 883µs making 3 calls to Sub::Install::__ANON__[Sub/Install.pm:132], avg 294µs/call
38 {
39 code => $warn,
40 into => $caller,
41 as => 'deprecated',
42 }
43 );
44
45 return;
46}
47
48
# spent 77µs within Package::DeprecationManager::_build_import which was called 3 times, avg 26µs/call: # 3 times (77µs+0s) by Package::DeprecationManager::import at line 24, avg 26µs/call
sub _build_import {
49691µs my $registry = shift;
50
51
# spent 1.46ms within Package::DeprecationManager::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Package/DeprecationManager.pm:61] which was called 8 times, avg 182µs/call: # once (1.21ms+0s) by Class::MOP::Package::BEGIN@9 at line 9 of Class/MOP/Package.pm # once (50µs+0s) by Moose::Util::TypeConstraints::BEGIN@28 at line 28 of Moose/Util/TypeConstraints.pm # once (35µs+0s) by Moose::BEGIN@14 at line 14 of Moose.pm # once (33µs+0s) by Moose::Meta::Attribute::Native::Trait::BEGIN@7 at line 7 of Moose/Meta/Attribute/Native/Trait.pm # once (33µs+0s) by Moose::Util::MetaRole::BEGIN@13 at line 13 of Moose/Util/MetaRole.pm # once (32µs+0s) by namespace::clean::BEGIN@16 at line 16 of namespace/clean.pm # once (32µs+0s) by Moose::Meta::Attribute::BEGIN@16 at line 16 of Moose/Meta/Attribute.pm # once (32µs+0s) by Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7 at line 7 of Moose/Util/TypeConstraints/OptimizedConstraints.pm
return sub {
5240423µs my $class = shift;
53 my %args = @_;
54
55 $args{-api_version} ||= delete $args{-compatible};
56
57 $registry->{ caller() } = $args{-api_version}
58 if $args{-api_version};
59
60 return;
61 };
62}
63
64
# spent 154µs within Package::DeprecationManager::_build_warn which was called 3 times, avg 51µs/call: # 3 times (154µs+0s) by Package::DeprecationManager::import at line 25, avg 51µs/call
sub _build_warn {
6521171µs my $registry = shift;
66 my $deprecated_at = shift;
67 my $ignore = shift;
68
69 my %ignore = map { $_ => 1 } grep { !ref } @{ $ignore || [] };
70 my @ignore_res = grep {ref} @{ $ignore || [] };
71
72 my %warned;
73
74 return sub {
75 my %args = @_ < 2 ? ( message => shift ) : @_;
76
77 my ( $package, undef, undef, $sub ) = caller(1);
78
79 my $skipped = 1;
80
81 if ( @ignore_res || keys %ignore ) {
82 while ( defined $package
83 && ( $ignore{$package} || any { $package =~ $_ } @ignore_res )
84 ) {
85 $package = caller( $skipped++ );
86 }
87 }
88
89 $package = 'unknown package' unless defined $package;
90
91 unless ( defined $args{feature} ) {
92 $args{feature} = $sub;
93 }
94
95 my $compat_version = $registry->{$package};
96
97 my $deprecated_at = $deprecated_at->{ $args{feature} };
98
99 return
100 if defined $compat_version
101 && defined $deprecated_at
102 && $compat_version lt $deprecated_at;
103
104 my $msg;
105 if ( defined $args{message} ) {
106 $msg = $args{message};
107 }
108 else {
109 $msg = "$args{feature} has been deprecated";
110 $msg .= " since version $deprecated_at"
111 if defined $deprecated_at;
112 }
113
114 return if $warned{$package}{ $args{feature} }{$msg};
115
116 $warned{$package}{ $args{feature} }{$msg} = 1;
117
118 # We skip at least two levels. One for this anon sub, and one for the
119 # sub calling it.
120 local $Carp::CarpLevel = $Carp::CarpLevel + $skipped;
121
122 Carp::cluck($msg);
123 };
124}
125
126111µs1;
127
128# ABSTRACT: Manage deprecation warnings for your distribution
129
- -
132=pod
133
- -
275__END__