Bump version requirement for MX::Emulate::CAF to the new release which fixes the...
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 28b8a27..0f70e5e 100644 (file)
@@ -1,7 +1,5 @@
 package Catalyst;
 
-use MRO::Compat;
-use mro 'c3';
 use Moose;
 extends 'Catalyst::Component';
 use bytes;
@@ -41,8 +39,6 @@ has request => (is => 'rw', default => sub { $_[0]->request_class->new({}) }, re
 has response => (is => 'rw', default => sub { $_[0]->response_class->new({}) }, required => 1, lazy => 1);
 has namespace => (is => 'rw');
 
-no Moose;
-
 attributes->import( __PACKAGE__, \&namespace, 'lvalue' );
 
 sub depth { scalar @{ shift->stack || [] }; }
@@ -376,19 +372,20 @@ Catalyst).
 
 =cut
 
-sub stash {
+around stash => sub {
+    my $orig = shift;
     my $c = shift;
+    my $stash = $orig->($c);
     if (@_) {
-        my $stash = @_ > 1 ? {@_} : $_[0];
-        croak('stash takes a hash or hashref') unless ref $stash;
-        foreach my $key ( keys %$stash ) {
-            #shouldn't we hold this in a var and save ourselves the subcall?
-            $c->next::method->{$key} = $stash->{$key};
+        my $new_stash = @_ > 1 ? {@_} : $_[0];
+        croak('stash takes a hash or hashref') unless ref $new_stash;
+        foreach my $key ( keys %$new_stash ) {
+          $stash->{$key} = $new_stash->{$key};
         }
     }
 
-    return $c->next::method;
-}
+    return $stash;
+};
 
 
 =head2 $c->error
@@ -701,14 +698,15 @@ L<Catalyst::Plugin::ConfigLoader>.
 
 =cut
 
-sub config {
+around config => sub {
+    my $orig = shift;
     my $c = shift;
 
     $c->log->warn("Setting config after setup has been run is not a good idea.")
       if ( @_ and $c->setup_finished );
 
-    $c->next::method(@_);
-}
+    $c->$orig(@_);
+};
 
 =head2 $c->log
 
@@ -814,7 +812,6 @@ Catalyst> line.
 
 sub setup {
     my ( $class, @arguments ) = @_;
-    Class::C3::initialize;
     $class->log->warn("Running setup twice is not a good idea.")
       if ( $class->setup_finished );
 
@@ -936,7 +933,6 @@ EOF
     $class->log->_flush() if $class->log->can('_flush');
 
     $class->setup_finished(1);
-    Class::C3::initialize;
 }
 
 =head2 $c->uri_for( $path, @args?, \%query_values? )
@@ -2451,4 +2447,8 @@ the same terms as Perl itself.
 
 =cut
 
+no Moose;
+
+__PACKAGE__->meta->make_immutable;
+
 1;