1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
use strict;
use warnings;
use Router::Simple;
use Test::More;
my $r = Router::Simple->new();
$r->connect(
'home',
'/' => { controller => 'Root', action => 'show' },
{
method => 'GET',
host => 'localhost',
on_match => sub { 1 }
}
);
my ( $ret, $route ) = $r->routematch(
{ HTTP_HOST => 'localhost', REQUEST_METHOD => 'GET', PATH_INFO => '/' }
);
is_deeply $route->method, ['GET'];
is_deeply $route->host, 'localhost';
is ref($route->on_match), 'CODE';
done_testing;
|