From: Florian Ragwitz Date: Mon, 3 Jan 2011 19:59:37 +0000 (+0000) Subject: Stop relying on Package::Stash PP bugs X-Git-Tag: 5.80030~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=31aeca68d9fa07102de15a04881ecad4ecf7104c Stop relying on Package::Stash PP bugs We want to know if $MyApp::_config contains something like a valid configuration, not if the package symbol exists. The pure-perl version Package::Stash has always been buggy in assuming that a scalar symbol containing undef is a symbol that doesn't exist. This is to work around the fact that getting the SCALAR slot from a glob in pure perl autovivifies the scalar to undef. Package::Stash::XS doesn't have that limitation and is used transparently by Package::Stash if it's installed. That exposed this bug in our code. --- diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index 28da155..d428826 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -127,7 +127,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_package_symbol('$_config') }) { # Call merge_hashes to ensure we deep copy the parent # config onto the subclass $self->_config( Catalyst::Utils::merge_hashes($config, {}) );