RE: Test for exectuable file in PATH

2001-08-31 Thread Jenda Krynicky
I want to determine if a particular exectuable file is available/exists within the path. Is there a switch or function available to with/instead of the -x test? I have an example to illustrate the results of what I want to do with a simpler approach. If you want it nicely packaged you

Re: Test for exectuable file in PATH

2001-08-31 Thread John Pataki
Jenda, WOW.. ask and you shall receive. Thanks! Nice work. It is almost as if you just created that as if I wrote that email? I was looking at the module and I was wondering ... in the following routine - if ($^O =~ /MSWin32/i) { foreach $extn (@extn) { -e $dir.'/'.$file.$extn and

Re: Test for exectuable file in PATH

2001-08-31 Thread John Pataki
... meant to include this in previous email Example: D:\test_file.pl Path to perl is : C:\Perl\bin\/perl.EXE D:\test_file.pl Path to notepad is : C:\WINNT\system32/notepad.EXE John Jenda Krynicky wrote: I want to determine if a particular exectuable file is available/exists

Re: Test for exectuable file in PATH

2001-08-31 Thread John Pataki
Jenda, What do think about these changes I propose to your module? I didn't realize it was so easy to write perl module? Man, I love Perl. foreach $dir (@dirs) { $dir = '.' unless $dir; chop $dir if $dir =~ /\\$|\/$/; # Change 1 - strip off ending slash if it exists if ($^O =~

Re: Test for exectuable file in PATH

2001-08-31 Thread Jeremy Wadsack
Even better, use the File::Spec::* modules to get portable file handling routines: use File::Spec; foreach $dir (@dirs) { $dir = File::Spec-curdir unless $dir; $dir = File::Spec-canonpath( $dir ); if ($^O =~ /MSWin32/i) { foreach $extn (@extn) { -e File::Spec-catfile(

Re: Test for exectuable file in PATH

2001-08-31 Thread Jenda Krynicky
Jenda, WOW.. ask and you shall receive. Thanks! Nice work. It is almost as if you just created that as if I wrote that email? No. I only dug it up in my old files. I was looking at the module and I was wondering ... in the following routine - if ($^O =~ /MSWin32/i) { foreach

Re: Test for exectuable file in PATH

2001-08-31 Thread John Pataki
Actually, I would bet that the other instances of detecting the OS could be resolved using the File::Spec module as well? I have attached Jenda's Which.pm Version 0.3 John John Pataki wrote: Jenda, I used the routine proposed by Jeremy in his reply and that also works very nicely.

Re: Test for exectuable file in PATH

2001-08-31 Thread Jeremy Wadsack
John Pataki ([EMAIL PROTECTED]): Actually, I would bet that the other instances of detecting the OS could be resolved using the File::Spec module as well? I have attached Jenda's Which.pm Version 0.3 I'm not sure what you mean John. I suggested File::Spec to portably handle file

Re: Test for exectuable file in PATH

2001-08-31 Thread John Pataki
Jeremy, Is there a method in the File::Spec module, that returns the path directories in a list no matter what the OS? Is so, wouldn't the File::Spec module, be able to handle the need for the use of the $splitchar and the need to build the list of dirctories via a loop? Perhaps there is no