[Catalyst] Major (for me) problem fixed! [patch]

Nathan Kurz nate at verse.com
Fri Jul 28 22:08:10 CEST 2006

On Fri, Jul 28, 2006 at 01:47:47PM -0500, Jonathan Rockway wrote:
> Kieren Diment wrote:
> > Right,
> >
> > Catalyst used to use Module::Plugable::Fast for component autodiscovery
> >
> > Now it uses Module::Pluggable::Object.
> >
> > This behaviour was fixed for M::P::F a while back but evidently hasn't 
> > been for M::P::O (and MPO produces a more cryptic error message too :( 
> > ).  So if you're up to it, rtfs for both, make a patch for MPO and 
> > send it to the author or to RT noting that the behaviour was fixed in 
> > MPF a while back.

I've been bothered by this problem as well, and appreciate your
efforts in tracking it down.  I've just been looking at how to write
the patch, and I found that there are some undocumented parts of
Module::Plugable::Object that make it possible to do this in Catalyst.

Attached is a patch that seems to work for me.  The 'only' option to
MPO tells it to use only modules that match the regular expression
given.  The regex I've chosen seems right to me, but perhaps it is too
restrictive---I'm not sure what's actually legal for a package name.

Nathan Kurz
nate at verse.com

ps. I've also found that MPO isn't the prettiest code, and it
    scares me a bit that Catalyst is built on top of it.

--- Catalyst.pm~        2006-07-19 15:48:15.000000000 -0600
+++ Catalyst.pm 2006-07-28 13:54:32.000000000 -0600
@@ -1790,6 +1790,7 @@
     my $locator = Module::Pluggable::Object->new(
         search_path => [ map { s/^(?=::)/$class/; $_; } @paths ],
+        only => qr/(^|::)\w+$/,

More information about the Catalyst mailing list