Merge branch 'master' into psgi
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Root.pm
CommitLineData
32d5a0c5 1package TestApp::Controller::Root;
5ab21903 2use strict;
3use warnings;
32d5a0c5 4use base 'Catalyst::Controller';
5
6__PACKAGE__->config->{namespace} = '';
7
81e75875 8sub chain_root_index : Chained('/') PathPart('') Args(0) { }
9
53119b78 10sub 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');
15}
16
19c01ee1 17sub localregex : LocalRegex('^localregex$') {
18 my ( $self, $c ) = @_;
19 $c->res->header( 'X-Test-Class' => ref($self) );
20 $c->response->content_type('text/plain; charset=utf-8');
21 $c->forward('TestApp::View::Dump::Request');
22}
23
a202886b 24sub index : Private {
25 my ( $self, $c ) = @_;
26 $c->res->body('root index');
27}
28
29sub global_action : Private {
30 my ( $self, $c ) = @_;
31 $c->forward('TestApp::View::Dump::Request');
32}
33
34sub class_forward_test_method :Private {
35 my ( $self, $c ) = @_;
36 $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
37}
38
39sub loop_test : Local {
40 my ( $self, $c ) = @_;
41
42 for( 1..1001 ) {
43 $c->forward( 'class_forward_test_method' );
44 }
45}
46
47sub recursion_test : Local {
48 my ( $self, $c ) = @_;
49 $c->forward( 'recursion_test' );
50}
51
9c74923d 52sub base_href_test : Local {
53 my ( $self, $c ) = @_;
54
55 my $body = <<"EndOfBody";
56<html>
57 <head>
58 <base href="http://www.example.com/">
59 </head>
60 <body>
61 </body>
62</html>
63EndOfBody
64
65 $c->response->body($body);
66}
67
a0a66cb8 68sub end : Private {
69 my ($self,$c) = @_;
70}
71
32d5a0c5 721;