X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent.pm;h=870418c1a8e59c26cb87a3a3aee20765f4501651;hb=67e9673e2729bf40b87a20b2afa350be19cd7f5e;hp=ee1f99ac33451b25ea197d8c67d7f3e42c6b7e27;hpb=d2598ac82e8508f4d6da90ec60a1ed60840c2016;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index ee1f99a..870418c 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -60,13 +60,16 @@ component loader with config() support and a process() method placeholder. __PACKAGE__->mk_classdata('_plugins'); __PACKAGE__->mk_classdata('_config'); -has _component_name => ( is => 'ro' ); # Cannot be required => 1 as context +has catalyst_component_name => ( is => 'ro' ); # Cannot be required => 1 as context # 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 -around _component_name => sub { +# 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 catalyst_component_name => sub { my ($orig, $self) = (shift, shift); - blessed($self) ? $self->$orig(@_) : $self; + Carp::cluck("Tried to write to the catalyst_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 {