} else {
$try
}
- } elsif (!ref($try) and ref($more->[0]) eq 'CODE') {
+ } elsif (!ref($try)
+ and (ref($more->[0]) eq 'CODE'
+ or (!ref($more->[0]) and $self->dispatch_object
+ and $self->dispatch_object->can($more->[0])))
+ ) {
$self->_construct_node(match => $try, run => shift(@$more));
} elsif (
(blessed($try) && $try->isa('Web::Dispatch::Matcher'))
package MiscTest;
sub dispatch_request { @dispatch }
+ sub string_method { [ 999, [], [""] ]; }
}
my $app = MiscTest->new;
sub run_request { $app->run_test_request( @_ ); }
+string_method_name();
app_is_non_plack();
app_is_object();
app_is_just_sub();
done_testing();
+sub string_method_name {
+ @dispatch = ( '/' => "string_method" );
+
+ my $get = run_request( GET => 'http://localhost/' );
+
+ cmp_ok $get->code, '==', 999, "a dispatcher that's a string matching a method on the dispatch object gets executed";
+}
+
sub app_is_non_plack {
my $r = HTTP::Response->new( 999 );