in reply to Who is turning $^W on?

Test::Harness calls the tests with the -w option. I think it didn't do that in older versions (well, on further checking it seems like it did).

Replies are listed 'Best First'.
Re^2: Who is turning $^W on?
by dragonchild (Archbishop) on Nov 08, 2004 at 16:16 UTC
    Gods, that's deep into the Makefile. How do I turn it off, either globally or locally to a given test?

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      While not very pretty, this seems to work when added at the top of the test file:

      BEGIN { $^W = 0 }

      Test::Harness lets you add command-line switches by setting the HARNESS_PERL_SWITCHES environment variable. But that doesn't work for removing the warnings, because it is just added to the existing switches.

        Sorry to reply to myself, but I've noticed that the HARNESS_PERL_SWITCHES variable may be useful for this after all, because the -X command line option overrides the -w option and disables all warnings. Just do the following:

        HARNESS_PERL_SWITCHES=-X make test

        But if you still wanted to keep the lexical warnings this won't do what you want, because it disables them as well.