Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ChrisDolan (2855)

  (email not shown publicly)

Journal of ChrisDolan (2855)

Wednesday February 14, 2007
04:49 PM

Module::Pluggable vs. Emacs

[ #32404 ]

So, I'm working on my Catalyst app and editing one of my controllers. I restart apache (app runs under mod_perl) and get a useless error message

Warning: Use of "require" without parentheses is ambiguous at (eval 357) line 1.
syntax error at (eval 357) line 2, at EOF
Compilation failed in require at /Users/chris/perl/lib/perl5/site_perl/Catalyst/ line 79.

Grr, I hate those. Something is dynamically loading a module that it doesn't like, but it's happening down in an eval{} so the error is obscured. So, I pop in a line:

use Carp; $SIG{__DIE__} = \&Carp::confess;

and discover that the file that's failing is "". Module::Pluggable has picked up an auto-save file that Emacs put down because I forgot to save a buffer before restarting. So, the fix is simply "C-x C-s".

After a day of fighting with Catalyst under FastCGI vs. mod_perl, I had to just laugh at this absurd failure.

But then I started thinking: how smart should Module::Pluggable be about special cases like that? Is this worth a bug report? Vi users don't have to suffer this because Module::Pluggable won't pick up the .swp files.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Since is not a valid module name, I don't think Module::Pluggable should be loading it. It's not a difficult thing to check. I'd file the bug report.

    • I concur.

      I'd expect Module::Pluggable to skip at the very least hidden files) but checking that the file name matches a legitimate module naming pattern works as well.
      • In fact, it works better, as it's a whitelist rather than a blacklist. So it won't have to be updated in the future. For example, I'd bet that you also want to ignore @._*@ (OS X droppings).
    • Hmm, I thought I was skipping non valid files. I'll have a check and see what's going on.
      • I think this line is at fault:

          next unless $plugin =~ m!(?:[a-z\d]+)[a-z\d]!i;
        It should probably be something like:

          next unless $plugin =~ m!\A [a-z]\w* (?: ::[a-z]\w* )* \z!ix;
        Does Perl allow Unicode in module names? I though not, but if so [a-z] is too restrictive