X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp.pm;h=c4f164954599a2a52e62b8d7e2dfb8bfb529e6ef;hb=21465c884872c1ec8c30acd72796445f9eaacb31;hp=2e9483eb073260b97684e33ca67f7545293c220c;hpb=e5d7f18ca33ac9a5df3e22a5d7161a4a3b2cce36;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index 2e9483e..c4f1649 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -2,6 +2,7 @@ package TestApp; use strict; use Catalyst qw[Test::Errors Test::Headers]; +use Catalyst::Utils; our $VERSION = '0.01'; @@ -20,22 +21,24 @@ sub global_action : Private { } sub execute { - my $c = shift; - my $class = ref( $c->component($_[0]) ) || $_[0]; - my $action = $c->actions->{reverse}->{"$_[1]"} || "$_[1]"; + my $c = shift; + my $class = ref( $c->component( $_[0] ) ) || $_[0]; + my $action = $c->actions->{reverse}->{"$_[1]"} || "$_[1]"; my $method; - if ( $action =~ /->(\w+)$/ ) { - $method = $1; + if ( $action =~ /->(\w+)$/ ) { + $method = $1; } - elsif ( $action =~ /\/(\w+)$/ ) { - $method = $1; + elsif ( $action =~ /\/(\w+)$/ ) { + $method = $1; } - my $executed = sprintf( "%s->%s", $class, $method ); - - $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed ); + if ( $class && $method ) { + my $executed = sprintf( "%s->%s", $class, $method ); + $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed ); + } + return $c->SUPER::execute(@_); }