X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=0f70e5e082bc588d76e60d85cc1b07839aca3aee;hp=28b8a27d9305726926aef1280dad0b13b62a3985;hb=afb82794328ff8da1efc0a4c37f3f3703c262c31;hpb=96d8d513f11c4fc078b4956a779a68f411cfbee6 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 28b8a27..0f70e5e 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -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. =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;