X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=596422c68e9ba76cd94658f7f0995393c3cb361d;hb=89cb63ec32ead40a2ba223fce60016e3c19ce5ab;hp=c337b30f20e00bd65c2787296b04679b61ad33af;hpb=48429f3d90ed27e6f771daa7a9aa0474849b5915;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index c337b30..596422c 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2410,7 +2410,27 @@ Starts the engine. =cut -sub run { my $c = shift; return $c->engine->run( $c, $c->_finalized_psgi_app, @_ ) } +sub run { + my $c = shift; + $c->engine_loader->needs_psgi_engine_compat_hack ? + $c->_run_needs_psgi_engine_compat_hack(@_) : + $c->engine->run( $c, $c->_finalized_psgi_app, @_ ); +} + +sub _run_needs_psgi_engine_compat_hack { + my $c = shift; + + ## We assume if they used the classic PSGI Engine, they must has CC:M + for my $metal (Catalyst::Controller::Metal->metals_for($c)) { + my $res = $metal->call(@_); + if (defined $res && !(ref $res eq 'ARRAY' && $res->[0] == 404)) { + return $res; + } + } + + ## If we got this far, just do the psgi app + $c->_finalized_psgi_app->(@_) +} =head2 $c->set_action( $action, $code, $namespace, $attrs )