From: Tomas Doran Date: Tue, 5 May 2009 15:36:26 +0000 (+0000) Subject: Fix deprecation error message in dispatcher to be useful. X-Git-Tag: 5.80004~47 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=3cd3bc6ae6c0282f98f1dd65676b98be379933ce Fix deprecation error message in dispatcher to be useful. --- diff --git a/Changes b/Changes index 5552be5..5f97880 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ # This file documents the revision history for Perl extension Catalyst. + - Fix deprecation message for Catalyst::Dispatcher to refer + to the class actually calling the deprecated method. RT#45741 (t0m) - Clarify limitations of $request->base and $request->secure. (Phil Mitchell) diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index defe7e3..c06c2a4 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -708,9 +708,12 @@ foreach my $public_method_name (qw/ # I haven't provided a way to disable them, patches welcome. $meta->add_before_method_modifier($public_method_name, sub { my $class = blessed(shift); + my $class = caller(2); + chomp($class); $package_hash{$class}++ || do { - warn("Class $class is calling the deprecated method Catalyst::Dispatcher::$public_method_name,\n" - . "this will be removed in Catalyst 5.9X\n"); + warn("Class $class is calling the deprecated method\n" + . " Catalyst::Dispatcher::$public_method_name,\n" + . " this will be removed in Catalyst 5.9X\n"); }; }); }