rrwo has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use the warnings pragma for my modules. In a simple module:
package foo;
use warnings::register;
sub bar {
if (warnings::enabled) {
warnings::warn "this is a warning";
}
}
The above works properly if I say 'use warnings' or 'no warnings' in my calling code.
But in larger (object oriented) modules it does not work. Or rather, warnings::enabled always returns false. If in the module I enable warnings, it works but I cannot turn off the warnings in my calling code.
Is there a bug in warnings, or is there some overlooked and possibly poorly-documented feature of warnings that I'm missing out on?
Also: Is there a way to get Carp working properly with warnings? (From what I've read, not yet. See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-11/msg01297.html)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: How do I get warnings to work properly?
by tilly (Archbishop) on Dec 07, 2000 at 19:17 UTC | |
by tilly (Archbishop) on Dec 09, 2000 at 04:56 UTC | |
|
(tye)Re: How do I get warnings to work properly?
by tye (Sage) on Dec 07, 2000 at 22:57 UTC | |
by rrwo (Friar) on Dec 11, 2000 at 18:56 UTC | |
by rrwo (Friar) on Dec 09, 2000 at 03:02 UTC |