1 package TestApp::Controller::Root;
4 use base 'Catalyst::Controller';
6 __PACKAGE__->config->{namespace} = '';
8 sub chain_root_index : Chained('/') PathPart('') Args(0) { }
10 sub zero : Path('0') {
11 my ( $self, $c ) = @_;
12 $c->res->header( 'X-Test-Class' => ref($self) );
13 $c->response->content_type('text/plain; charset=utf-8');
14 $c->forward('TestApp::View::Dump::Request');
17 sub zerobody : Local {
22 sub emptybody : Local {
27 sub localregex : LocalRegex('^localregex$') {
28 my ( $self, $c ) = @_;
29 $c->res->header( 'X-Test-Class' => ref($self) );
30 $c->response->content_type('text/plain; charset=utf-8');
31 $c->forward('TestApp::View::Dump::Request');
35 my ( $self, $c ) = @_;
36 $c->res->body('root index');
39 sub global_action : Private {
40 my ( $self, $c ) = @_;
41 $c->forward('TestApp::View::Dump::Request');
44 sub class_forward_test_method :Private {
45 my ( $self, $c ) = @_;
46 $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
49 sub loop_test : Local {
50 my ( $self, $c ) = @_;
53 $c->forward( 'class_forward_test_method' );
57 sub recursion_test : Local {
58 my ( $self, $c ) = @_;
59 $c->forward( 'recursion_test' );
62 sub base_href_test : Local {
63 my ( $self, $c ) = @_;
65 my $body = <<"EndOfBody";
68 <base href="http://www.example.com/">
75 $c->response->body($body);
78 sub body_semipredicate : Local {
80 $c->res->body; # Old code tests length($c->res->body), which causes the value to be built (undef), which causes the predicate
81 $c->res->status( $c->res->has_body ? 500 : 200 ); # to return the wrong thing, resulting in a 500.
82 $c->res->body('Body');