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=63f3dbb90ef693408cb5c14b552ce8c56ea7fa96;hb=afb82794328ff8da1efc0a4c37f3f3703c262c31;hpb=6f1f968a6bc42bf4a4b50a1ee22d3aaecd801876 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 63f3dbb..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 ); @@ -923,7 +920,9 @@ EOF } # Add our self to components, since we are also a component - $class->components->{$class} = $class->setup_component($class); + if( $class->isa('Catalyst::Controller') ){ + $class->components->{$class} = $class; + } $class->setup_actions; @@ -934,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? ) @@ -2449,4 +2447,8 @@ the same terms as Perl itself. =cut +no Moose; + +__PACKAGE__->meta->make_immutable; + 1;