Mine is, essentially, 5 lines of code. A snippet. You can reduce that even more if you don't care about other extensions than the default qw(.exe .com .bat) (the others might not even work). Do you really need a module for that?
use File::Spec;
my @exec = map { my $p = $_; grep { -f and -x } map File::Spec->catfil
+e($p, "$f$_"), '', qw(.exe .com .bat) } File::Spec->path
or die "Can't find executable $f";
Oh, and I found a bug in the module:
#!/usr/bin/perl -wl
use File::Which;
open OUT, '>complexe'; close OUT;
print for which('complexe');
which prints out
.\complexe
The author has forgotten to use quotemeta. The file name matches /.exe$/, but still, it's not a program file name.
|