X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=d8641265bef6e5d9d579e447fe5665da081f70b8;hp=4714ed6bfcbb5676ab1b6dc13bfcbad06bae4148;hb=532f0516947cf047368e91150ca2ab1cfd4c1e64;hpb=4904ee278992db70da965b94627728085b88de54 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 4714ed6..d864126 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -29,6 +29,7 @@ use Tree::Simple::Visitor::FindByUID; use Class::C3::Adopt::NEXT; use List::MoreUtils qw/uniq/; use attributes; +use String::RewritePrefix; use utf8; use Carp qw/croak carp shortmess/; use Try::Tiny; @@ -2552,8 +2553,9 @@ sub setup_engine { unless ($engine) { $engine = $class->engine_class; } - $engine = 'Catalyst::Engine::' . $engine - unless $engine =~ /^Catalyst::Engine/; + else { + $engine = String::RewritePrefix->rewrite( { '' => 'Catalyst::Engine::', '+' => '' }, $engine ); + } $engine = 'Catalyst::Engine' if $engine eq 'Catalyst::Engine::HTTP'; @@ -2591,6 +2593,11 @@ sub setup_engine { ); } + if ($ENV{MOD_PERL}) { + # FIXME - Immutable + $class->meta->add_method(handler => sub { shift->handle_request(@_) }); + } + $class->engine( $engine->new ); $class->psgi_app( $class->engine->build_psgi_app($class) ); }