Merged 5.49_01 (r1339) from refactored branch to trunk
[catagits/Catalyst-Runtime.git] / t / live / lib / TestApp.pm
CommitLineData
dd4e6fd2 1package TestApp;
2
3use strict;
fbcc39ad 4use Catalyst qw/Test::Errors Test::Headers Test::Plugin/;
1408d0a4 5use Catalyst::Utils;
dd4e6fd2 6
7our $VERSION = '0.01';
8
fbcc39ad 9TestApp->config( name => 'TestApp', root => '/some/dir' );
dd4e6fd2 10
11TestApp->setup;
12
e5d7f18c 13sub global_action : Private {
2656a6de 14 my ( $self, $c ) = @_;
15 $c->forward('TestApp::View::Dump::Request');
16}
17
dd4e6fd2 18sub 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
451;