Commit | Line | Data |
2f381252 |
1 | package TestApp::Controller::Action::Go; |
2 | |
3 | use strict; |
4 | use base 'TestApp::Controller::Action'; |
5 | |
6 | sub one : Local { |
7 | my ( $self, $c ) = @_; |
8 | $c->go('two'); |
9 | } |
10 | |
11 | sub two : Private { |
12 | my ( $self, $c ) = @_; |
13 | $c->go('three'); |
14 | } |
15 | |
16 | sub three : Local { |
17 | my ( $self, $c ) = @_; |
18 | $c->go( $self, 'four' ); |
19 | } |
20 | |
21 | sub four : Private { |
22 | my ( $self, $c ) = @_; |
23 | $c->go('/action/go/five'); |
24 | } |
25 | |
26 | sub five : Local { |
27 | my ( $self, $c ) = @_; |
ae0e35ee |
28 | $c->forward('View::Dump::Request'); |
2f381252 |
29 | } |
30 | |
31 | sub inheritance : Local { |
32 | my ( $self, $c ) = @_; |
33 | $c->go('/action/inheritance/a/b/default'); |
34 | } |
35 | |
36 | sub global : Local { |
37 | my ( $self, $c ) = @_; |
38 | $c->go('/global_action'); |
39 | } |
40 | |
41 | sub with_args : Local { |
42 | my ( $self, $c, $arg ) = @_; |
43 | $c->go( 'args', [$arg] ); |
44 | } |
45 | |
46 | sub with_method_and_args : Local { |
47 | my ( $self, $c, $arg ) = @_; |
48 | $c->go( qw/TestApp::Controller::Action::Go args/, [$arg] ); |
49 | } |
50 | |
51 | sub args : Local { |
52 | my ( $self, $c, $val ) = @_; |
53 | die "passed argument does not match args" unless $val eq $c->req->args->[0]; |
54 | $c->res->body($val); |
55 | } |
56 | |
57 | sub go_die : Local { |
58 | my ( $self, $c, $val ) = @_; |
59 | eval { $c->go( 'args', [qq/new/] ) }; |
60 | $c->res->body( $@ ? $@ : "go() did not die" ); |
61 | die $Catalyst::GO; |
62 | } |
63 | |
64 | sub go_chained : Local { |
65 | my ( $self, $c, $val ) = @_; |
66 | $c->go('/action/chained/foo/spoon',[1]); |
67 | } |
68 | |
ae0e35ee |
69 | sub view : Local { |
70 | my ( $self, $c, $val ) = @_; |
71 | eval { $c->go('View::Dump') }; |
72 | $c->res->body( $@ ? $@ : "go() did not die" ); |
73 | } |
74 | |
75 | sub model : Local { |
76 | my ( $self, $c, $val ) = @_; |
77 | eval { $c->go('Model::Foo') }; |
78 | $c->res->body( $@ ? $@ : "go() did not die" ); |
79 | } |
80 | |
2f381252 |
81 | sub args_embed_relative : Local { |
82 | my ( $self, $c ) = @_; |
83 | $c->go('embed/ok'); |
84 | } |
85 | |
86 | sub args_embed_absolute : Local { |
87 | my ( $self, $c ) = @_; |
88 | $c->go('/action/go/embed/ok'); |
89 | } |
90 | |
91 | sub embed : Local { |
92 | my ( $self, $c, $ok ) = @_; |
93 | $ok ||= 'not ok'; |
94 | $c->res->body($ok); |
95 | } |
96 | |
97 | sub class_go_test_action : Local { |
98 | my ( $self, $c ) = @_; |
99 | $c->go(qw/TestApp class_go_test_method/); |
100 | } |
101 | |
102 | 1; |