From: Dave Rolsky Date: Wed, 14 Jul 2010 18:37:37 +0000 (-0500) Subject: Warn once per error message per feature, so different errors all show up X-Git-Tag: v0.04~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7bbad815c0ca97ab085ce2cf4dcf95627ca4ac21;p=gitmo%2FPackage-DeprecationManager.git Warn once per error message per feature, so different errors all show up --- diff --git a/lib/Package/DeprecationManager.pm b/lib/Package/DeprecationManager.pm index ee370bd..d733815 100644 --- a/lib/Package/DeprecationManager.pm +++ b/lib/Package/DeprecationManager.pm @@ -96,8 +96,6 @@ sub _build_warn { && defined $deprecated_at && $compat_version lt $deprecated_at; - return if $warned{$package}{ $args{feature} }; - my $msg; if ( defined $args{message} ) { $msg = $args{message}; @@ -108,7 +106,9 @@ sub _build_warn { if defined $deprecated_at; } - $warned{$package}{ $args{feature} } = 1; + return if $warned{$package}{ $args{feature} }{$msg}; + + $warned{$package}{ $args{feature} }{$msg} = 1; local $Carp::CarpLevel = $Carp::CarpLevel + 1 + $skipped; @@ -206,8 +206,10 @@ to the feature name passed in the C<-deprecations> hash. If you don't explicitly specify a feature, the C sub uses C to identify its caller, using its fully qualified subroutine name. -Deprecation warnings are only issued once for a given package, regardless of -how many times the deprecated sub/method is called. +A given deprecation warning is only issued once for a given package. This +module tracks this based on both the feature name I the error message +itself. This means that if you provide severaldifferent error messages for the +same feature, all of those errors will appear. =head1 BUGS