On Feb 24, 2004, at 8:46 AM, Rafael Garcia-Suarez wrote:

But since it's inside an eval() call, those messages should get stuck
in $@ and NOT printed.  As Randy has said, they would kill a normal
program, if they were in the source.  They are not warnings.

Nope. They are warnings, except that they are mandatory ones. You need to write explicitly "no warnings" to disable them. If you do, those messages go in $@ instead.

This is incorrect and easily proved. Please run the following:


#!/usr/bin/perl

use strict;
use warnings;

my @code = (
        q('a poorly 'nested' string'),
        q('a poorly 'nested::nested' string'),
);

for (@code) {
        {
                no warnings;
                eval;
        }
#       print "Caught: $@" if $@;
}

print "\nExiting normally.\n";

__END__

Note that ALL warnings are explicitly disabled and the program is no longer printing the error messages yet the strange messages remain. Also note that the program does reach the final print.

Those messages are fatal errors that just don't happen to kill the program here, since they happen inside an eval(). They are being trapped, but we are still being notified (incorrectly). If they were lines in a normal script, it would not run.

That looks like a bug to me. I just wanted to make sure I wasn't missing something before submitting it. What do others think?

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to