X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp.pm;h=acb4a646ecfb1bad0015aab49b0a37512bd0db66;hb=4d989a5da1809be1088a985e02dff19f89b8cfd6;hp=e7f2ae281f1073d2edcfe7838f0487943d1c3fc4;hpb=dd4e6fd2152eea9f5b0c1f559575ced7684ef257;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index e7f2ae2..acb4a64 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -14,21 +14,27 @@ 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 ); + my $executed = sprintf( "%s->%s", $class, $method ) + if ( $class && $method ); $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed ); return $c->SUPER::execute(@_);