[Catalyst-commits] r11122 - Catalyst-Runtime/5.80/trunk/lib/Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Aug 11 21:49:37 GMT 2009


Author: t0m
Date: 2009-08-11 21:49:37 +0000 (Tue, 11 Aug 2009)
New Revision: 11122

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
Log:
Unfuck Catalyst::View::JSON

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm	2009-08-11 20:34:53 UTC (rev 11121)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm	2009-08-11 21:49:37 UTC (rev 11122)
@@ -64,9 +64,12 @@
                                        # class @ISA component - HATE
 # Make accessor callable as a class method, as we need to call setup_actions
 # on the application class, which we don't have an instance of, ewwwww
+# Also, naughty modules like Catalyst::View::JSON try to write to _everything_,
+# so spit a warning, ignore that (and try to do the right thing anyway) here..
 around _component_name => sub {
     my ($orig, $self) = (shift, shift);
-    blessed($self) ? $self->$orig(@_) : $self;
+    Carp::cluck("Tried to write to the _component_name accessor - is your component broken or just mad? (Write ignored - using default value.)") if scalar @_;
+    blessed($self) ? $self->$orig() || blessed($self) : $self;
 };
 
 sub BUILDARGS {




More information about the Catalyst-commits mailing list