Added . support to xmlrpc
[catagits/Catalyst-Runtime.git] / t / lib / TestApp.pm
1 package TestApp;
2
3 use strict;
4 use Catalyst qw[Test::Errors Test::Headers];
5
6 our $VERSION = '0.01';
7
8 TestApp->config(
9     name => 'TestApp',
10     root => '/Users/chansen/src/MyApp/root',
11 );
12
13 TestApp->setup;
14
15 #sub execute { return shift->NEXT::execute(@_); } # does not work, bug?
16
17 sub global_action : Private {
18     my ( $self, $c ) = @_;
19     $c->forward('TestApp::View::Dump::Request');
20 }
21
22 sub 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       if ( $class && $method );
38
39     $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed );
40     return $c->SUPER::execute(@_);
41 }
42
43 1;