Subject: | File::Which bug if path given |
Hi,
I found a problem with File::Which that is causing me a headache. Where your module & Unix's "which" program behaves quite differently.
The issue is when someone passes path information along with the program name.
So while $p=File::Which::which("perl"); works fine and returns /usr/bin/perl as expected,
$p=File::Which::which("./perl") doesn't work properly. It also returns /usr/bin/perl instead of the perl under my home directory! Should I use @p instead of $p, it shows up as the last element in the array. ("." is the final element of my Path, but if I remove "." from the path, it doesn't find the program at all, but Unix's "which" command still finds it.)
When the Unix "which" command encounters a program name with a path in it, it no longer looks at the path in your environment, the program either exists or it doesn't. So the fix to your module is to assume the path is only the current directory if someone provides any path info (relative or absolute) along with the program name.
I have no objections if you convert the relative path into a full absolute path or leave it relative.
Curtis