3 use HTTP::Request::Common;
8 eval "use Type::Tiny 1.000005; 1" || do {
9 plan skip_all => "Trouble loading Type::Tiny and friends => $@";
15 $INC{'MyApp/Types.pm'} = __FILE__;
21 use Types::Standard -types;
24 -declare => qw( UserId Heart );
26 extends "Types::Standard";
39 package MyApp::Controller::Root;
40 $INC{'MyApp/Controller/Root.pm'} = __FILE__;
43 use MooseX::MethodAttributes;
44 use MyApp::Types qw/Tuple Int Str StrMatch ArrayRef Enum UserId Heart/;
46 extends 'Catalyst::Controller';
48 sub user :Local Args(1)
49 Query(page=>Int,user=>Tuple[Enum['a','b'],Int]) {
50 my ($self, $c, $int) = @_;
51 $c->res->body("page ${\$c->req->query_parameters->{page}}, user ${\$c->req->query_parameters->{user}[1]}");
54 sub default :Default {
55 my ($self, $c, $int) = @_;
56 $c->res->body('default');
59 MyApp::Controller::Root->config(namespace=>'');
67 use Catalyst::Test 'MyApp';
70 my $res = request '/user/1?page=10&user=a&user=100';
71 is $res->content, 'page 10, user 100';