catalyst_component_name doesn't have to be a class accessor anymore
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Component.pm
index 28da155..8a21a46 100644 (file)
@@ -63,14 +63,12 @@ __PACKAGE__->mk_classdata('_config');
 
 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
-# Also, naughty modules like Catalyst::View::JSON try to write to _everything_,
+# 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);
     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;
+    return $self->$orig() || blessed($self);
 };
 
 sub BUILDARGS {
@@ -127,7 +125,7 @@ sub config {
         # TODO maybe this should be a ClassData option?
         my $class = blessed($self) || $self;
         my $meta = Class::MOP::get_metaclass_by_name($class);
-        unless ($meta->has_package_symbol('$_config')) {
+        unless (${ $meta->get_or_add_package_symbol('$_config') }) {
             # Call merge_hashes to ensure we deep copy the parent
             # config onto the subclass
             $self->_config( Catalyst::Utils::merge_hashes($config, {}) );