X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FLog.pm;h=a28c373924510a6a3633e1bd1a984d52f9dfa918;hp=a131821719f2952209d239f9ea53dde114bcd1a3;hb=71415389f4a9968c22da3255dcaaf2669fa58731;hpb=e99ec2dcc083716c88a86a89b9017c6a78a260a9 diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index a131821..a28c373 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -101,6 +101,21 @@ sub _send_to_log { print STDERR @_; } +# 5.7 compat code. +# Alias _body to body, add a before modifier to warn.. +my $meta = __PACKAGE__->meta; # Calling meta method here fine as we happen at compile time. +$meta->add_method('body', $meta->get_method('_body')); +my %package_hash; # Only warn once per method, per package. + # I haven't provided a way to disable them, patches welcome. +$meta->add_before_method_modifier('body', sub { + my $class = blessed(shift); + $package_hash{$class}++ || do { + warn("Class $class is calling the deprecated method Catalyst::Log->body method,\n" + . "this will be removed in Catalyst 5.81"); + }; +}); +# End 5.70 backwards compatibility hacks. + no Moose; __PACKAGE__->meta->make_immutable(inline_constructor => 0);