[Catalyst-commits] r9766 - in Catalyst-Runtime/5.80/trunk: . lib/Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Apr 20 22:28:47 GMT 2009


Author: t0m
Date: 2009-04-20 23:28:46 +0100 (Mon, 20 Apr 2009)
New Revision: 9766

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
Log:
Unfuck Catalyst::Plugin::Log::Dispatch

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2009-04-20 18:39:26 UTC (rev 9765)
+++ Catalyst-Runtime/5.80/trunk/Changes	2009-04-20 22:28:46 UTC (rev 9766)
@@ -1,5 +1,7 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+        - Add backwards compatibility method for Catalyst::Log->body, which
+          has been made private (t0m)
         - Fix so that calling $c->req->parameters(undef) does not flatten
           the request parameters with undef + test (t0m)
         - Fix so that width of table of unattached actions for debugging

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm	2009-04-20 18:39:26 UTC (rev 9765)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm	2009-04-20 22:28:46 UTC (rev 9766)
@@ -101,6 +101,21 @@
     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);
 




More information about the Catalyst-commits mailing list