Hi,
I've created a File::Which module for use for the mod_perl site and which
exports a which() function based on the one in mod_perl 2.0. I've tweaked
it a little so it works with different extensions on Win32 too. And it
handles ~ in the PATH correctly.
Here is a patch to use this instead of misc. which subroutines in mod_perl 2.
I'm not able to test it as I can't compile mod_perl myself (Win32 here),
but unless there's a serious bug in the module, I don't see any reasons for
it not working.
I suppose you will have to add File::Which as a prerequisite (and in turn
it needs File::Spec and File::HomeDir ), but I couldn't find the place to
do that.
Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file:
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.128
diff -u -r1.128 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm 6 Apr 2002 02:39:31
-0000 1.128
+++ Apache-Test/lib/Apache/TestConfig.pm 19 Apr 2002 11:21:31 -0000
@@ -18,6 +18,7 @@
use File::Path ();
use File::Spec::Functions qw(catfile abs2rel splitdir
catdir file_name_is_absolute);
+use File::Which qw(which);
use Cwd qw(fastcwd);
use Apache::TestConfigPerl ();
@@ -1223,16 +1224,6 @@
#utils
-#duplicating small bits of Apache::Build so we dont require it
-sub which {
- foreach (map { catfile $_, $_[0] } File::Spec->path) {
- return $_ if -x;
- if (WIN32) {
- my $exe = "$_.exe";
- return $exe if -x $exe;
- }
- }
-}
sub apxs {
my($self, $q, $ok_fail) = @_;
Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.79
diff -u -r1.79 Build.pm
--- lib/Apache/Build.pm 7 Apr 2002 02:56:52 -0000 1.79
+++ lib/Apache/Build.pm 19 Apr 2002 11:21:33 -0000
@@ -13,6 +13,7 @@
use ModPerl::Code ();
use ModPerl::BuildOptions ();
use Apache::TestTrace;
+use File::Which qw(which);
use constant REQUIRE_ITHREADS => grep { $^O eq $_ } qw(MSWin32);
use constant HAS_ITHREADS =>
@@ -111,11 +112,6 @@
$cflags;
}
-sub which {
- foreach (map { File::Spec->catfile($_, $_[0]) } File::Spec->path) {
- return $_ if -x;
- }
-}
#--- Perl Config stuff ---
--
Per Einar Ellefsen
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]