in reply to Re^5: Warnings not working on one machine
in thread Warnings not working on one machine
Have you read Reporting Warnings from a Module? This can be used to achieve precisely what you have outlined as your goal here. eg:
package Foo; use warnings::register; sub bar { $^W = warnings::enabled () ? 1 : 0; print $baz; }; 1; package main; use warnings 'Foo'; Foo::bar (); no warnings 'Foo'; Foo::bar ();
If you run this you will only see one occurrence of the warning Use of uninitialized value $Foo::baz in print at /tmp/warnshow.pl line 9. which is caused by the first call to Foo::bar (). The second call does not generate the warning. HTH.
|
|---|