On Thu, Nov 14, 2002 at 04:12:51PM +1100, Ken Williams wrote:
> Oy, though. It's doing more work than it needs to. Why not just check
> the exit value?
>
> my $ok = !system($abs, '-e', "exit !eval 'require $ver; 1'");
$ perl -wle 'print "Its perl!" if !system("/bin/true", "-e", "exit !eval q{require
5.005; 1}")'
Its perl!
There's no guarantee that what we're checking will be perl or will run at
all. It might be a broken perl. It might be perl1. :)
$ perl1 -e 'exit !eval q{require 5.005; 1}'
Segmentation fault
STDERR must be closed to prevent error messages from various failed commands
from leaking out. STDOUT must be closed or trapped for the same reason.
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
They had applied the blinders of steam-grilled hamburgers to my eyes.