When modules collide

jk2addict on 2006-10-04T17:39:53

After installing a copy of strawberry perl and running Handel tests under that, I started getting prototype mismatch warnings that I never received under older versions:

t\subclassing.............................ok 1/68Prototype mismatch: sub Handel::Checkout::except (&;$) vs none at C:/strawberry-perl/perl/site/lib/Module/Pluggable.pm line 67.

I was stumped for a while, then I remembered this post by Ovid and the answer hit me.

use Module::Pluggable;
use Error ':try';

I completely forget that Error has an except block. They're both competing for except(). Duh. M::P creates an except on the fly, and the :try tag tells Error to export it's except(). Changing Error to import just try/catch/with solved the problem. If I wanted to use Errors' except(), who knows how that would work.

I stared at the M::P code for the longest time trying to figure out where the prototype declaration was. Go figure.

What has me curious is that this warning apparently only happens in 5.8.8 and not previous versions. Must have something to do with anon subs added on the fly after at compile time.


warnings in 5.8.8

dagolden on 2006-10-04T20:21:06

There was a bug fix with warnings in 5.8.8 that might be related. From 'perldoc perl588delta':

  no warnings 'category' works correctly with -w
    Previously when running with warnings enabled globally via "-w",
    selective disabling of specific warning categories would actually turn
    off all warnings. This is now fixed; now "no warnings 'io';" will only
    turn off warnings in the "io" class. Previously it would erroneously
    turn off all warnings.

    This bug fix may cause some programs to start correctly issuing
    warnings.

Re:warnings in 5.8.8

Aristotle on 2006-10-06T18:04:51

selective disabling of specific warning categories would actually turn off all warnings

Nasty!!

If you need both excepts...

Alias on 2006-10-05T00:12:48

Inevitably you have to use it fully referenced...

Error::try { ...
};
And so on, rather than using them as exported symbols.