Hi,

I have had a problems with output when running tests, this happends, IE,  when 
perl output a warning.

warning_like
        {
        something() ;
        } qr'Use of uninitialized value in substitution iterator' ;


I get the warning on the terminal which is boring when one works with a module 
but worse when zealots (that would be Gabor) report it. Since I didn't 
remember that the warnings were normal, I had to dig a bit to find that out.

While playing around I noticed that the above test could be written like this:

{
# grab the warning so it's not displayed on the terminal
# warning_like still works !!
local $SIG{'__WARN__'} = sub {} ; 

warning_like
        {
        something() ;
        } qr'Use of uninitialized value in substitution iterator';
}

I first thought that it would fail the test but it didn't. I added some 
warnings and the warning_like did it's job properly. 

BTW: Test::Warn suck a bit because it doesn't check the warning you emit but 
the _first_ line of the warning you emit (hmm, time for a patch maybe).

Cheers, Nadim

Reply via email to