X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FWeb%2FDispatch.pm;fp=lib%2FWeb%2FDispatch.pm;h=d9e76ca85103276bdfc4e4ee2eb0c014f95cd22e;hb=d9ae38d990f923f213576fdc880e246842fdd6c2;hp=1b2dda0ba85fbaca8f90da4983e75001d2c30fc6;hpb=4ba6d891dd8c3b7ea92540466329b40de2e6ff80;p=catagits%2FWeb-Simple.git diff --git a/lib/Web/Dispatch.pm b/lib/Web/Dispatch.pm index 1b2dda0..d9e76ca 100644 --- a/lib/Web/Dispatch.pm +++ b/lib/Web/Dispatch.pm @@ -40,6 +40,9 @@ sub _dispatch { my @result = $self->_to_try($try, \@match)->($env, @match); next unless @result and defined($result[0]); if (ref($result[0]) eq 'ARRAY') { + if (@{$result[0]} == 1 and ref($result[0][0]) eq 'CODE') { + return $result[0][0]; + } return $result[0]; } elsif (blessed($result[0]) && $result[0]->isa('Plack::Middleware')) { die "Multiple results but first one is a middleware ($result[0])"