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