From: Dave Rolsky Date: Thu, 14 Oct 2010 19:08:29 +0000 (-0500) Subject: Fix $skipped usage X-Git-Tag: v0.05~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=23bc88dc167585017b05f6f3cd52000fc412d110;p=gitmo%2FPackage-DeprecationManager.git Fix $skipped usage --- diff --git a/lib/Package/DeprecationManager.pm b/lib/Package/DeprecationManager.pm index d733815..423c104 100644 --- a/lib/Package/DeprecationManager.pm +++ b/lib/Package/DeprecationManager.pm @@ -71,13 +71,12 @@ sub _build_warn { my ( $package, undef, undef, $sub ) = caller(1); - my $skipped = 0; + # We want to start two levels back, since we already looked + # one level back and found an internal package. + my $skipped = 1; if ( keys %ignore ) { while ( defined $package && $ignore{$package} ) { - # We want to start two levels back, since we already looked - # one level back and found an internal package. - $package = caller($skipped++ + 2); - $skipped++; + $package = caller($skipped++); } } @@ -110,7 +109,7 @@ sub _build_warn { $warned{$package}{ $args{feature} }{$msg} = 1; - local $Carp::CarpLevel = $Carp::CarpLevel + 1 + $skipped; + local $Carp::CarpLevel = $Carp::CarpLevel + $skipped; Carp::cluck($msg); }; @@ -185,7 +184,7 @@ in your distribution that can appear on the call stack when a deprecated feature is used. As part of the import process, C will export two -subroutines into its caller. It proves an C sub for the caller and a +subroutines into its caller. It provides an C sub for the caller and a C sub. The C sub allows callers of I class to specify an C<-api_version>