typo
[catagits/Catalyst-Runtime.git] / t / lib / TestApp.pm
CommitLineData
dd4e6fd2 1package TestApp;
2
3use strict;
4use Catalyst qw[Test::Errors Test::Headers];
5
6our $VERSION = '0.01';
7
8TestApp->config(
9 name => 'TestApp',
10 root => '/Users/chansen/src/MyApp/root',
11);
12
13TestApp->setup;
14
15#sub execute { return shift->NEXT::execute(@_); } # does not work, bug?
16
e5d7f18c 17sub global_action : Private {
2656a6de 18 my ( $self, $c ) = @_;
19 $c->forward('TestApp::View::Dump::Request');
20}
21
dd4e6fd2 22sub execute {
23 my $c = shift;
24 my $class = ref( $c->component($_[0]) ) || $_[0];
25 my $action = $c->actions->{reverse}->{"$_[1]"} || "$_[1]";
26
27 my $method;
28
29 if ( $action =~ /->(\w+)$/ ) {
30 $method = $1;
31 }
32 elsif ( $action =~ /\/(\w+)$/ ) {
33 $method = $1;
34 }
35
36 my $executed = sprintf( "%s->%s", $class, $method );
37
38 $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed );
39 return $c->SUPER::execute(@_);
40}
41
421;