From: John Napiorkowski Date: Fri, 26 Jul 2013 19:21:28 +0000 (-0400) Subject: make sure we try looking in th project namespace for middleware first X-Git-Tag: 5.90050~1^2~52 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=318213cd42113e94d8a98a9e06542b7f31eb1557 make sure we try looking in th project namespace for middleware first --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 101e673..d6aeb88 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -3067,10 +3067,11 @@ compatible interface, or a coderef, which is assumed to be inlined middleware =head2 setup_middleware (?@middleware) -Read configuration information stored in configuration key 'psgi_middleware' -and invoke L for each middleware prototype found. See -under L information regarding L and how to -use it to enable L +Read configuration information stored in configuration key C or +from passed @args. + +See under L information regarding C and how +to use it to enable L This method is automatically called during 'setup' of your application, so you really don't need to invoke it. diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index afa9d32..29a7959 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -453,10 +453,10 @@ sub build_middleware { $namespace->new(@init_args) : die "Can't load class $namespace"; } else { ## the string is a partial namespace - if(Class::Load::try_load_class("Plack::Middleware::$namespace")) { ## Act like Plack::Builder - return "Plack::Middleware::$namespace"->new(@init_args); - } elsif(Class::Load::try_load_class("$class::$namespace")) { ## Load Middleware from Project namespace - return "$class::$namespace"->new(@init_args); + if(Class::Load::try_load_class("$class::$namespace")) { ## Load Middleware from Project namespace + return "$class::$namespace"->new(@init_args); + } elsif(Class::Load::try_load_class("Plack::Middleware::$namespace")) { ## Act like Plack::Builder + return "Plack::Middleware::$namespace"->new(@init_args); } }