fixed bug before draven finished test case :P
[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
17sub execute {
18 my $c = shift;
19 my $class = ref( $c->component($_[0]) ) || $_[0];
20 my $action = $c->actions->{reverse}->{"$_[1]"} || "$_[1]";
21
22 my $method;
23
24 if ( $action =~ /->(\w+)$/ ) {
25 $method = $1;
26 }
27 elsif ( $action =~ /\/(\w+)$/ ) {
28 $method = $1;
29 }
30
31 my $executed = sprintf( "%s->%s", $class, $method );
32
33 $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed );
34 return $c->SUPER::execute(@_);
35}
36
371;