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

Nathan Kurz nate at verse.com
Mon Jul 31 17:04:30 CEST 2006


On Mon, Jul 31, 2006 at 02:53:01PM +0100, Matt S Trout wrote:
> Module::Pluggable also has a test suite and a responsive maintainer;
> neither can be said of M::P::F.

Thanks, those are fine reasons to be using it.  I never saw M::P::F,
and if this is a step up then it's probably the right choice.

> > ---------------------------------------------------------------------
> > --- 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+$/,
> >          %$config
> >      );
> 
> Note the '%$config' there. In MyApp,
> 
> http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7001/lib/Catalyst.pm#%24c-%3Esetup_components
> 
> __PACKAGE__->config({
>    setup_components => { only => qr/(^|::)\w+$/ }
> });
> 
> will fix this without requiring a patch to anything.

That's true, but I think it would be better to have a more sensible
default behaviour.  In the absence of the 'only' parameter, the
Catalyst application fails with a non-specific error message if a
non-compilable file ending with .pm exists anywhere in the search
path.  Since this happens only sporadically (when a temporary autosave
file exists), and since the error message makes no reference to the
specific file, it's quite hard to figure out what is happening.

And since the documentation for M::P::O doesn't mention 'only', it's a
lot to expect each individual to figure out how to fix the problem.  I
think this would make better sense as a patch to Catalyst.  It might
help to understand this bug if you were to create a '.junk.pm' file
filled with some junk, and see whether the steps to fixing the problem
would readily be apparent.  Then pretend the problem is intermittent.

Until M::P::O is patched to have this default, I think patching
Catalyst to supply it would be a good choice.  That said, now that I
know the source of the error message and the incantation to prevent
it, I personally could deal just fine with setting the option myself.

--nate





More information about the Catalyst mailing list