in reply to Weird use warnings FATAL behavior

The error you supply doesn't agree with the code you provided. (In addition, as per the FAQ, you should bracket your code with <code> and </code>).

You dont't need the eval. Instead, use: open(CMD, "_bad_exe_") or die "open failed: $!\n" };

Replies are listed 'Best First'.
Re^2: Weird use warnings FATAL behavior
by ikegami (Patriarch) on Mar 17, 2008 at 23:14 UTC

    The error supplied doesn't agree with the code provided, but I get it too. I'm using an older version of Perl, though. I don't have a newer version for that system, so it could have been fixed since.

    $ perl -e 'use warnings FATAL => qw(all); eval { open(CMD, "_bad_exe_ +a b c|") or die "open failed: $!\n" }; if($@){ die "$$: ERROR: $@" } +print "$$: HOW DID I GET HERE?\n"; while(<CMD>){}' 11089: ERROR: Can't exec "_bad_exe_": No such file or directory at -e +line 1. 11089: HOW DID I GET HERE? $ perl -v This is perl, v5.8.4 built for i386-linux-thread-multi ...

    Update: I added the PID to the error messages in case something went bad with the forking code.

    Update: Interestingly, open dies instead of returning an error. Notice how "open failed" is not part of the output. Are there two bugs here?

Re^2: Weird use warnings FATAL behavior
by ww (Archbishop) on Mar 17, 2008 at 23:58 UTC
    Odd. Here's what happens with Ubuntu and 5.8.7:
    ww@GIG:~$ perl -v This is perl, v5.8.7 built for i486-linux-gnu-thread-multi (with 1 registered patch, see perl -V for more detail)

    OP's cut'n'pasted oneliner:

    ww@GIG:~$ perl -e 'use warnings FATAL => qw(all); eval { open(CMD, "_b +ad_e xe_ a b c|") or die "open failed: $!\n" }; if($@){ die "ERROR: $ +@" }; print "HOW DID I GET HERE?\n"; while(<CMD>){}' ERROR: Can't exec "_bad_exe_": No such file or directory at -e line 1. HOW DID I GET HERE? ww@GIG:~$