X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp.pm;h=c4f164954599a2a52e62b8d7e2dfb8bfb529e6ef;hb=21465c884872c1ec8c30acd72796445f9eaacb31;hp=e7f2ae281f1073d2edcfe7838f0487943d1c3fc4;hpb=dd4e6fd2152eea9f5b0c1f559575ced7684ef257;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index e7f2ae2..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'; @@ -14,23 +15,30 @@ TestApp->setup; #sub execute { return shift->NEXT::execute(@_); } # does not work, bug? +sub global_action : Private { + my ( $self, $c ) = @_; + $c->forward('TestApp::View::Dump::Request'); +} + 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(@_); }