in reply to Re: How do I curtail the noise
in thread How do I curtail the noise

This isn't something I've looked into, but doesn't Perl have some mechanism to prevent loading the same module twice? I know I've seen something like this in C #include files -- one of the first lines is an #ifdef that checks to see if this file has been included already, and if so, skips the entire file.

As a corollary, why would a developer want to load a module twice?

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^3: How do I curtail the noise
by Corion (Patriarch) on Jul 14, 2010 at 14:39 UTC

    Perl uses %INC to keep track of require'd files. On case-insensitive file systems, you can load the same file under more than one name. For example:

    use Strict;

    loads strict.pm but never calls its import method.

      And is it useful to be able to have a strict.pm?

      I note that putting

      use Carp; use carp;
      in a module isn't flagged by perlcritic. Should this be an error, either of style or of syntax?

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        There is no use to having Perl load "both" Strict.pm and strict.pm, especially if they both end up being the same file on some filesystems. But that that's possible is a side effect of hash keys (like in %INC) being case-sensitive and file systems sometimes being case-insensitive. I can't come up with a useful use for that.

        Having two modules whose names only differ in case is non-portable at least, and in my opinion could always be flagged as a potential error. But then, I avoid Perl::Critic, so I wouldn't know how to implement it.