On Monday, May 19, 2003, at 07:57 PM, Stas Bekman wrote:
As long as they hide it from MakeMaker so it won't attempt to install it, which will just cause an inconvenience to its users.
Of course. Mine is in t/lib, as is Mason's, I believe.
And here is a patch that will try to alert users to remove old Apache/test.pm if any. Probably not very useful as most will miss the warnings, but we can always say, "you have been warned" ;)
I'm just not sure that it's a good idea to silently nuke any files at all.
Index: Apache-Test/Makefile.PL =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Makefile.PL,v retrieving revision 1.8 diff -u -r1.8 Makefile.PL --- Apache-Test/Makefile.PL 29 Apr 2003 06:37:47 -0000 1.8 +++ Apache-Test/Makefile.PL 20 May 2003 03:13:56 -0000 @@ -2,12 +2,14 @@
use ExtUtils::MakeMaker; use Symbol; +use File::Spec::Functions qw(catfile catdir);
use lib qw(lib);
my $VERSION;
use Apache::Test5005compat; +use Apache::TestTrace;
use Apache::TestMM qw(test); #enable 'make test'
@@ -21,6 +23,8 @@
set_version();
+find_old_Apache_test_pm();
+
WriteMakefile(
NAME => 'Apache::Test',
VERSION => $VERSION,
@@ -57,5 +61,41 @@
EOF return $string;
+}
+
+# on case-insensitive systems we want to alert users to remove
+# Apache/test.pm if any
+sub find_old_Apache_test_pm {
+ my $is_case_insensitive = -e catfile qw(lib Apache testconfig.pm);
+
+ return unless $is_case_insensitive;
+
+ eval { require Apache::test };
+ return if $@; # not found any m|Apache/[Tt]est.pm|
+
+ my $old_file;
+
+ unless (defined $Apache::Test::VERSION) {
+ $old_file = $INC{"Apache/test.pm"};
+ } else {
+ # picked Apache/Test.pm instead of Apache/test.pm. Next
+ # traverse manually to check whether we have
+ # Apache/test.pm installed
+ foreach (@INC) {
+ my $dir = catdir $_, "Apache";
+ next unless -d $dir;
+ opendir DIR, $dir or die "Cannot opendir $dir: $!\n";
+ my @matches = grep /^test.pm$/, readdir DIR;
+ closedir DIR;
+ next unless @matches;
+ $old_file = catfile $dir, $matches[0];
+ last;
+ }
+ }
+
+ if ($old_file) {
+ error "Please remove the stale file $old_file, or you may" .
+ "have problems running tests";
+ }
}__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
