If a class makes itself immutable and turns off constructor inlining, die with an...
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 066339c..67caa15 100644 (file)
@@ -3,7 +3,6 @@ package Catalyst;
 use Moose;
 extends 'Catalyst::Component';
 use Moose::Util qw/find_meta/;
-use Moose::Util::MetaRole ();
 use bytes;
 use Scope::Upper ();
 use Catalyst::Exception;
@@ -1102,6 +1101,12 @@ EOF
     # applying modifiers).
     Scope::Upper::reap(sub {
         my $meta = Class::MOP::get_metaclass_by_name($class);
+        if ( $meta->is_immutable && ! { $meta->immutable_options }->{inline_constructor} ) {
+            die "You made your application class ($class) immutable, "
+                . "but did not inline the constructor.\n"
+                . "This will break catalyst, please pass "
+                . "(replace_constructor => 1) when making your class immutable.\n";
+        }
         $meta->make_immutable(replace_constructor => 1) unless $meta->is_immutable;
     }, Scope::Upper::SCOPE(1));
 
@@ -2169,7 +2174,6 @@ sub setup_components {
 sub _controller_init_base_classes {
     my ($app_class, $component) = @_;
     foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) {
-        next unless $class =~ /^$app_class/;
         Moose->init_meta( for_class => $class )
             unless find_meta($class);
     }