Apache2-Controller
view release on metacpan or search on metacpan
t/unit_dispatch_hashtree.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use blib;
package TestApp::HashTree::Dispatch;
use base qw( Apache2::Controller::Dispatch::HashTree );
sub dispatch_map { {
foo => {
default => 'TestApp::HashTree::Foo',
bar => {
biz => 'TestApp::HashTree::Biz',
baz => 'TestApp::HashTree::Baz',
},
},
default => 'TestApp::HashTree::Default',
} }
1;
=for comment
/subdir/foo TestApp::HashTree::Foo->default()
/subdir/foo/bar TestApp::HashTree::Foo->bar()
/subdir/foo/bar/zerm TestApp::HashTree::Foo->bar(), path_args == ['zerm']
/subdir/foo/bar/biz TestApp::HashTree::Biz->default()
/subdir/foo/biz/baz/noz/wiz TestApp::HashTree::Baz->noz(), path_args == ['wiz']
=cut
package main;
use strict;
use warnings;
use English '-no_match_vars';
use Log::Log4perl qw(:easy);
use FindBin;
use lib "$FindBin::Bin/lib";
use Test::More qw( no_plan );
use YAML::Syck;
use Apache2::Controller::Test::Mockr;
use Apache2::Controller::X;
my $tests = Load(q{
foo:
controller: TestApp::HashTree::Foo
method: default
relative_uri: foo
'foo/bar':
controller: TestApp::HashTree::Foo
method: bar
relative_uri: foo
'foo/bar/zerm':
controller: TestApp::HashTree::Foo
method: bar
relative_uri: foo
path_args:
- zerm
'foo/bar/biz':
controller: TestApp::HashTree::Biz
relative_uri: foo/bar/biz
method: default
'foo/bar/baz/noz/wiz':
controller: TestApp::HashTree::Baz
method: noz
relative_uri: foo/bar/baz
path_args:
- wiz
'/':
controller: TestApp::HashTree::Default
method: default
relative_uri: ''
bar:
controller: TestApp::HashTree::Default
method: bar
relative_uri: ''
lame:
controller: TestApp::HashTree::Default
method: default
relative_uri: ''
'bar/none/some':
controller: TestApp::HashTree::Default
method: bar
relative_uri: ''
path_args:
- none
- some
( run in 0.657 second using v1.01-cache-2.11-cpan-e1769b4cff6 )