more useful options | |
PerlMonks |
Re: More pipe problemsby spudzeppelin (Pilgrim) |
on Jul 19, 2001 at 00:00 UTC ( [id://97864]=note: print w/replies, xml ) | Need Help?? |
Actually, the explanation behind this one is even simpler. You're opening a pipe to perl, with "non-existant_file" called as an argument. That pipe will succeed; perl will be opened, and subsequently exit, but the point is that the "open" call itself was successful -- you were able to open a handle to a perl process. The cheap and easy way around this is to make sure that whatever you intend to open on a pipe is executable and has the shebang at the top, and omit the perl. e.g.:
This way, when non-existant_file fails to execute, the open call fails, and you should die the way you intended. As an aside, it doesn't even have to be perl inside the pipe for this to be a factor. This could just as easily have been a pipe to awk or gzip or foobarbazwhee with incorrect arguments -- as long as the right-hand side of the pipe is, in fact, invoked, open doesn't fail. Spud Zeppelin * spud@spudzeppelin.com
In Section
Seekers of Perl Wisdom
|
|