Added recursive -r flag to prove example
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Forward.pm
1 package TestApp::Controller::Action::Forward;
2
3 use strict;
4 use base 'TestApp::Controller::Action';
5
6 sub one : Local {
7     my ( $self, $c ) = @_;
8     $c->forward('two');
9 }
10
11 sub two : Private {
12     my ( $self, $c ) = @_;
13     $c->forward('three');
14 }
15
16 sub three : Local {
17     my ( $self, $c ) = @_;
18     $c->forward('four');
19 }
20
21 sub four : Private {
22     my ( $self, $c ) = @_;
23     $c->forward('/action/forward/five');
24 }
25
26 sub five : Local {
27     my ( $self, $c ) = @_;
28     $c->forward('TestApp::View::Dump::Request');
29 }
30
31 sub six : Local {
32     my ( $self, $c ) = @_;
33     $c->forward('TestApp::View::Dump::False');
34 }
35
36
37 sub jojo : Local {
38     my ( $self, $c ) = @_;
39     $c->forward('one');
40     $c->forward('three');
41 }
42
43
44 sub inheritance : Local {
45     my ( $self, $c ) = @_;
46     $c->forward('/action/inheritance/a/b/default');
47     $c->forward('five');
48 }
49
50 sub global : Local {
51     my ( $self, $c ) = @_;
52     $c->forward( '/global_action' );
53 }
54
55 sub with_args : Local {
56     my ( $self, $c, $orig ) = @_;
57     $c->forward( 'args',[qq/new/] );
58     $c->res->body( $c->req->args->[0] );
59 }
60
61 sub with_method_and_args : Local {
62     my ( $self, $c, $orig ) = @_;
63     $c->forward( qw/TestApp::Controller::Action::Forward args/, [qq/new/] );
64     $c->res->body( $c->req->args->[0] );
65 }
66
67 sub args : Local {
68     my ( $self, $c, $val ) = @_;
69     die "Expected argument 'new', got '$val'" unless $val eq 'new';
70     die "passed argument does not match args" unless $val eq $c->req->args->[0];
71 }
72
73 1;