Commit | Line | Data |
c7ded7aa |
1 | package TestApp::Controller::Action::Detach; |
2 | |
3 | use strict; |
4 | use base 'TestApp::Controller::Action'; |
5 | |
6 | sub one : Local { |
7 | my ( $self, $c ) = @_; |
8 | $c->detach('two'); |
9 | $c->forward('error'); |
10 | } |
11 | |
12 | sub two : Private { |
13 | my ( $self, $c ) = @_; |
14 | $c->forward('TestApp::View::Dump::Request'); |
15 | } |
16 | |
17 | sub error : Local { |
18 | my ( $self, $c ) = @_; |
19 | $c->res->output('error'); |
20 | } |
21 | |
22 | sub path : Local { |
23 | my ( $self, $c ) = @_; |
24 | $c->detach('/action/detach/two'); |
25 | $c->forward('error'); |
26 | } |
27 | |
28 | sub with_args : Local { |
29 | my ( $self, $c, $orig ) = @_; |
30 | $c->detach( 'args', [qq/new/] ); |
31 | } |
32 | |
33 | sub with_method_and_args : Local { |
34 | my ( $self, $c, $orig ) = @_; |
35 | $c->detach( qw/TestApp::Controller::Action::Detach args/, [qq/new/] ); |
36 | } |
37 | |
38 | sub args : Local { |
39 | my ( $self, $c, $val ) = @_; |
40 | die "Expected argument 'new', got '$val'" unless $val eq 'new'; |
41 | die "passed argument does not match args" unless $val eq $c->req->args->[0]; |
42 | $c->res->body( $c->req->args->[0] ); |
43 | } |
44 | |
45 | 1; |