in reply to Re: `which` (for Windows) in pure perl
in thread `which` (for Windows) in pure perl
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:
which prints out#!/usr/bin/perl -wl use File::Which; open OUT, '>complexe'; close OUT; print for which('complexe');
The author has forgotten to use quotemeta. The file name matches /.exe$/, but still, it's not a program file name..\complexe
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: `which` (for Windows) in pure perl
by jwkrahn (Abbot) on Apr 23, 2006 at 21:20 UTC | |
|
Re^3: `which` (for Windows) in pure perl (bugs)
by tye (Sage) on Apr 24, 2006 at 14:53 UTC |