John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

given
use warnings; # implies 'all' use Some::Module; # does a warnings::register Some::Module::badcall();
The call to badcall() will see that that module's warnings are enabled. Looking at the code in use warnings and use warnings::register, I see that adding a category will extend the mask for 'all' to include the new bit, but it can't do a thing about the existing values of ${^WARNING_BITS}. Shouldn't that new bit still be off in this scope?

Replies are listed 'Best First'.
Re: How does this code work (warnings.pm)?
by chromatic (Archbishop) on Aug 08, 2002 at 19:42 UTC

    If I understand your question correctly, you are asking why enabling all warnings doesn't enable warnings that don't exist yet? I think it's because it doesn't know what warnings will exist until they do exist. That doesn't mean I think it's an unreasonable idea, just that the current implementation makes it a little tricky. This is a core module, so any proposals to change it should be directed to p5p.

      No, I found emperically that it does enable warnings that don’t exist yet, and I don’t see how that’s happening. The code looks like it should, like you say, be unaware of them and they are created as off.

      —John