X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=52b77876f8f65b143d840aaa77e6198b124a6b20;hp=664f0d2aa9f727f60c0396e7ba54d71b1cfac1e9;hb=2f5cb0703a06e037f2521ba220242a937d0e35b9;hpb=71415389f4a9968c22da3255dcaaf2669fa58731 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 664f0d2..52b7787 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2,6 +2,7 @@ package Catalyst; use Moose; extends 'Catalyst::Component'; +use Moose::Util qw/find_meta/; use bytes; use Scope::Upper (); use Catalyst::Exception; @@ -2161,6 +2162,14 @@ sub setup_components { =cut +sub _controller_init_base_classes { + my ($class, $component) = @_; + foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) { + Moose->init_meta( for_class => $class ) + unless find_meta($class); + } +} + sub setup_component { my( $class, $component ) = @_; @@ -2168,6 +2177,14 @@ sub setup_component { return $component; } + # FIXME - Ugly, ugly hack to ensure the we force initialize non-moose base classes + # nearest to Catalyst::Controller first, no matter what order stuff happens + # to be loaded. There are TODO tests in Moose for this, see + # f2391d17574eff81d911b97be15ea51080500003 + if ($component->isa('Catalyst::Controller')) { + $class->_controller_init_base_classes($component); + } + my $suffix = Catalyst::Utils::class2classsuffix( $component ); my $config = $class->config->{ $suffix } || {};