4b59d58641f5b21ad3b814291fdb95215a35e28b
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Regexp.pm
1 package TestApp::Controller::Action::Regexp;
2
3 use strict;
4 use base 'TestApp::Controller::Action';
5
6 sub one : Action Regex('^action/regexp/(\w+)/(\d+)$') {
7     my ( $self, $c ) = @_;
8     $c->forward('TestApp::View::Dump::Request');
9 }
10
11 sub two : Action LocalRegexp('^(\d+)/(\w+)$') {
12     my ( $self, $c ) = @_;
13     $c->forward('TestApp::View::Dump::Request');
14 }
15
16 sub three : Action LocalRegex('^(mandatory)(/optional)?$'){
17     my ( $self, $c ) = @_;
18     $c->forward('TestApp::View::Dump::Request');
19 }
20
21 sub four : Action Regex('^action/regexp/redirect/(\w+)/universe/(\d+)/everything$') {
22     my ( $self, $c ) = @_;
23     $c->res->redirect(
24         $c->uri_for($c->action, $c->req->captures,
25             @{$c->req->arguments}, $c->req->params
26         )
27     );
28 }
29
30 1;