in reply to checking for existence of a file in perl
For your specific needs, checking for the existence of a file may be more work than is needed (to do well), and too unreliable. If it's an executable shell script, does it reside in the account's root directory, in a /bin folder somewhere, or in some other alternate location? If the user moves the executable and then puts a pointer in his path the shell script may remain executable, while disappearing from where your Perl script expects it to be.
To put it in simple terms, just because the file doesn't exist where you expect it to doesn't mean it won't execute. And just because it does exist doesn't mean it will execute.
Rather than testing for its existence, it might be better to test for success in execution. If the real question is "can I execute the script", just do it, and write some code that handles failure to execute.
Dave
|
|---|