Revision history for Web-Simple
+ - produce a sensible error for (GET => undef) on 5.8
+
0.030 - 2014-08-07
- make dispatch_misc.t handle Plack's MockHTTP's on error behaviour changing
}
} elsif (!ref($try)
and (ref($more->[0]) eq 'CODE'
- or (!ref($more->[0]) and $self->dispatch_object
+ or ($more->[0] and !ref($more->[0]) and $self->dispatch_object
and $self->dispatch_object->can($more->[0])))
) {
$self->_construct_node(match => $try, run => shift(@$more));
package MiscTest;
sub dispatch_request { @dispatch }
sub string_method { [ 999, [], [""] ]; }
+
+ sub can {
+ die "Passed undef to can, this blows up on 5.8" unless defined($_[1]);
+ shift->SUPER::can(@_)
+ }
}
my $app = MiscTest->new;
route_returns_middleware_plus_extra();
route_returns_undef();
matcher_nonsub_pair();
+matcher_undef_method();
done_testing();
like $get->content, qr[No idea how we got here with Web::Dispatch::M],
"the error message points out the broken definition";
}
+
+sub matcher_undef_method {
+ @dispatch = ( 'GET', undef );
+
+ my $get = run_request( GET => 'http://localhost/' );
+
+ cmp_ok $get->code, '==', 500, "a route definition that pairs a WD::Matcher a non-sub dies";
+ like $get->content, qr[No idea how we got here with GET],
+ "the error message points out the broken definition";
+}