in reply to Re: How to detect X?
in thread How to detect X?
It [exec] fails and returns false only if the command does not exist and it is executed directly instead of via your system's command shell (see below).Since in this case "$bin/$name.X" must exist, the exec will succeed. The fact that "$bin/$name.X" can't do its job doesn't mean the exec will magically resurrect the program.
In fact, if you turn warnings on, the lines you give above will generate a warning:
Since it's a common mistake to use "exec" instead of "system", Perl warns you if there is a following statement which isn't "die", "warn", or "exit" (if "-w" is set - but you always do that).
|
---|