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 | ||
e0e47c71 | 13 | sub index : Private { |
14 | my ( $self, $c ) = @_; | |
15 | $c->res->body( 'root index' ); | |
16 | } | |
17 | ||
e5d7f18c | 18 | sub global_action : Private { |
2656a6de | 19 | my ( $self, $c ) = @_; |
20 | $c->forward('TestApp::View::Dump::Request'); | |
21 | } | |
22 | ||
dd4e6fd2 | 23 | sub execute { |
4d989a5d | 24 | my $c = shift; |
25 | my $class = ref( $c->component( $_[0] ) ) || $_[0]; | |
fbcc39ad | 26 | my $action = "$_[1]"; |
dd4e6fd2 | 27 | |
28 | my $method; | |
29 | ||
4d989a5d | 30 | if ( $action =~ /->(\w+)$/ ) { |
31 | $method = $1; | |
dd4e6fd2 | 32 | } |
4d989a5d | 33 | elsif ( $action =~ /\/(\w+)$/ ) { |
34 | $method = $1; | |
dd4e6fd2 | 35 | } |
36 | ||
ba599d1c | 37 | if ( $class && $method && $method !~ /^_/ ) { |
1408d0a4 | 38 | my $executed = sprintf( "%s->%s", $class, $method ); |
fbcc39ad | 39 | my @executed = $c->response->headers->header('X-Catalyst-Executed'); |
40 | push @executed, $executed; | |
41 | $c->response->headers->header( | |
42 | 'X-Catalyst-Executed' => join ', ', | |
43 | @executed | |
44 | ); | |
1408d0a4 | 45 | } |
fbcc39ad | 46 | |
dd4e6fd2 | 47 | return $c->SUPER::execute(@_); |
48 | } | |
49 | ||
50 | 1; |