From: Andy Grundman Date: Fri, 30 Dec 2005 20:01:59 +0000 (+0000) Subject: Fixed callsub determination when execute has been extended (i.e. from StackTrace) X-Git-Tag: 5.7099_04~763 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=02d2619e275aefc0e4e6d4c08cbeff09d66d9f32;hp=5513038d01b39b9a30d2c55e8ec85895bbe90f10 Fixed callsub determination when execute has been extended (i.e. from StackTrace) --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 6da1329..9935d18 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -892,15 +892,8 @@ sub execute { $class = $c->components->{$class} || $class; $c->state(0); - my $callsub = - ( caller(0) )[0]->isa('Catalyst::Action') - ? ( caller(2) )[3] - : ( caller(1) )[3]; - - my $action = ''; - if ( $c->debug ) { - $action = "$code"; + my $action = "$code"; $action = "/$action" unless $action =~ /\-\>/; $c->counter->{"$code"}++; @@ -911,6 +904,14 @@ sub execute { $c->state(0); return $c->state; } + + # determine if the call was the result of a forward + my $callsub_index = ( caller(0) )[0]->isa('Catalyst::Action') ? 2 : 1; + if ( ( caller($callsub_index) )[3] =~ /^NEXT/ ) { + # work around NEXT if execute was extended by a plugin + $callsub_index += 3; + } + my $callsub = ( caller($callsub_index) )[3]; $action = "-> $action" if $callsub =~ /forward$/;