6
my $r = Router::Simple->new();
7
$r->connect('home', '/' => {controller => 'Root', action => 'show'}, {method => 'GET', host => 'localhost'});
8
$r->connect('blog_monthly', '/blog/{year}/{month}', {controller => 'Blog', action => 'monthly'}, {method => 'GET'});
9
$r->connect('/blog/{year:\d{1,4}}/{month:\d{2}}/{day:\d\d}', {controller => 'Blog', action => 'daily'}, {method => 'GET'});
10
$r->connect('/comment', {controller => 'Comment', 'action' => 'create'}, {method => 'POST'});
11
$r->connect('/', {controller => 'Root', 'action' => 'show_sub'}, {method => 'GET', host => 'sub.localhost'});
12
$r->connect(qr{^/belongs/([a-z]+)/([a-z]+)$}, {controller => 'May', action => 'show'});
13
$r->connect('/:controller/:action');
16
$r->match( +{ REQUEST_METHOD => 'GET', PATH_INFO => '/', HTTP_HOST => 'localhost'} ),
23
$r->match( +{ PATH_INFO => '/blog/2010/03', HTTP_HOST => 'localhost', REQUEST_METHOD => 'GET' } ) || undef,
33
$r->match( +{ PATH_INFO => '/blog/2010/03/04', HTTP_HOST => 'localhost', REQUEST_METHOD => 'GET' } ) || undef,
37
year => 2010, month => '03', day => '04',
42
$r->match( +{ PATH_INFO => '/blog/2010/03', HTTP_HOST => 'localhost', REQUEST_METHOD => 'POST' } ) || undef,
46
$r->match( +{ PATH_INFO => '/comment', HTTP_HOST => 'localhost', REQUEST_METHOD => 'POST' } ) || undef,
48
controller => 'Comment',
53
$r->match( +{ PATH_INFO => '/', HTTP_HOST => 'sub.localhost', REQUEST_METHOD => 'GET' } ) || undef,
60
$r->match( +{ PATH_INFO => '/belongs/to/us', HTTP_HOST => 'localhost', REQUEST_METHOD => 'GET' } ) || undef,
64
splat => ['to', 'us'],
68
$r->match( +{ PATH_INFO => '/foo/bar', HTTP_HOST => 'localhost', REQUEST_METHOD => 'GET' } ) || undef,