X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=4afa241ab348e52eea348d7f79508ac5936df1a4;hb=e5429fee2de5b8f0046ea53dd5a2ede04bcb1a9d;hp=7d6e4fa98db0fb295c4fcd5a63b0ec536d761989;hpb=28591cd7cf934c9aa0a692e89ee9f40338814020;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 7d6e4fa..4afa241 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -24,8 +24,7 @@ __PACKAGE__->mk_accessors( attributes->import( __PACKAGE__, \&namespace, 'lvalue' ); -sub depth { scalar @{shift->stack||[]}; } -#sub namespace { my $a = shift->stack->[-1]; ($a ? $a->namespace : ''); } +sub depth { scalar @{ shift->stack || [] }; } # Laziness++ *comp = \&component; @@ -55,7 +54,7 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI'); __PACKAGE__->request_class('Catalyst::Request'); __PACKAGE__->response_class('Catalyst::Response'); -our $VERSION = '5.49_03'; +our $VERSION = '5.49_04'; sub import { my ( $class, @arguments ) = @_; @@ -844,7 +843,11 @@ sub execute { my ( $c, $class, $code ) = @_; $class = $c->components->{$class} || $class; $c->state(0); - my $callsub = ( caller(1) )[3]; + + my $callsub = + ( caller(0) )[0]->isa('Catalyst::Action') + ? ( caller(2) )[3] + : ( caller(1) )[3]; my $action = ''; if ( $c->debug ) { @@ -862,7 +865,7 @@ sub execute { $action = "-> $action" if $callsub =~ /forward$/; } - push(@{$c->stack}, $code); + push( @{ $c->stack }, $code ); eval { if ( $c->debug ) { @@ -879,7 +882,7 @@ sub execute { $c->state( &$code( $class, $c, @{ $c->req->args } ) || 0 ); } }; - pop(@{$c->stack}); + pop( @{ $c->stack } ); if ( my $error = $@ ) { @@ -1670,6 +1673,10 @@ sub setup_plugins { } } +=item $c->stack + +Contains the stack. + =item $c->write( $data ) Writes $data to the output stream. When using this method directly, you will