Commit | Line | Data |
---|---|---|
dd4e6fd2 | 1 | package TestApp; |
2 | ||
3 | use strict; | |
fbcc39ad | 4 | use Catalyst qw/Test::Errors Test::Headers Test::Plugin/; |
1408d0a4 | 5 | use Catalyst::Utils; |
dd4e6fd2 | 6 | |
7 | our $VERSION = '0.01'; | |
8 | ||
fbcc39ad | 9 | TestApp->config( name => 'TestApp', root => '/some/dir' ); |
dd4e6fd2 | 10 | |
11 | TestApp->setup; | |
12 | ||
e5d7f18c | 13 | sub global_action : Private { |
2656a6de | 14 | my ( $self, $c ) = @_; |
15 | $c->forward('TestApp::View::Dump::Request'); | |
16 | } | |
17 | ||
dd4e6fd2 | 18 | sub execute { |
4d989a5d | 19 | my $c = shift; |
20 | my $class = ref( $c->component( $_[0] ) ) || $_[0]; | |
fbcc39ad | 21 | my $action = "$_[1]"; |
dd4e6fd2 | 22 | |
23 | my $method; | |
24 | ||
4d989a5d | 25 | if ( $action =~ /->(\w+)$/ ) { |
26 | $method = $1; | |
dd4e6fd2 | 27 | } |
4d989a5d | 28 | elsif ( $action =~ /\/(\w+)$/ ) { |
29 | $method = $1; | |
dd4e6fd2 | 30 | } |
31 | ||
1408d0a4 | 32 | if ( $class && $method ) { |
33 | my $executed = sprintf( "%s->%s", $class, $method ); | |
fbcc39ad | 34 | my @executed = $c->response->headers->header('X-Catalyst-Executed'); |
35 | push @executed, $executed; | |
36 | $c->response->headers->header( | |
37 | 'X-Catalyst-Executed' => join ', ', | |
38 | @executed | |
39 | ); | |
1408d0a4 | 40 | } |
fbcc39ad | 41 | |
dd4e6fd2 | 42 | return $c->SUPER::execute(@_); |
43 | } | |
44 | ||
45 | 1; |