On Thu, 27 Nov 2003, Stas Bekman wrote:

> Randy Kobes wrote:
> [...]
> > I think it is a ModPerl::BuildMM thing - this patch
[ .. ]
> > arranges for everything to be put under an Apache2/.
>
> Cool.  Though, it's probably easier to read:
>
>    $v =~ s{(blib([/\\])lib)}{$1$2Apache2};
>
> or even:
>
>    $v =~ s{ (blib[/\\]lib) }{ catdir $1, 'Apache2'}xe;
>
> I thought there is at least one more variation of the dir
> separator, wasn't it ':'?

Good point - how about
===========================================================
Index: lib/ModPerl/BuildMM.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v
retrieving revision 1.12
diff -u -r1.12 BuildMM.pm
--- lib/ModPerl/BuildMM.pm      11 Sep 2003 01:31:22 -0000      1.12
+++ lib/ModPerl/BuildMM.pm      29 Nov 2003 12:54:59 -0000
@@ -5,7 +5,7 @@

 use ExtUtils::MakeMaker ();
 use Cwd ();
-use File::Spec;
+use File::Spec::Functions qw(catdir catfile splitdir);
 use File::Basename;

 use Apache::Build ();
@@ -20,7 +20,7 @@
 ModPerl::MM::override_eu_mm_mv_all_methods(@methods);
 use strict 'refs';

-my $apache_test_dir = File::Spec->catdir(Cwd::getcwd(), "Apache-Test", "lib");
+my $apache_test_dir = catdir(Cwd::getcwd(), "Apache-Test", "lib");

 #to override MakeMaker MOD_INSTALL macro
 sub mod_install {
@@ -144,7 +144,7 @@
 sub ModPerl::BuildMM::MY::postamble {
     my $self = shift;

-    my $doc_root = File::Spec->catdir(Cwd::getcwd(), "docs", "api");
+    my $doc_root = catdir(Cwd::getcwd(), "docs", "api");

     my @targets = ();

@@ -153,10 +153,10 @@

     if (-d $doc_root) {
         while (my ($pm, $blib) = each %{$self->{PM}}) {
-            my $pod = File::Spec->catdir(
-                (File::Spec->splitdir($blib))[-2 .. -1]);
+            my $pod = catdir(
+                (splitdir($blib))[-2 .. -1]);
             $pod =~ s/\.pm/\.pod/;
-            my $podpath = File::Spec->catfile($doc_root, $pod);
+            my $podpath = catfile($doc_root, $pod);
             next unless -r $podpath;

             push @target,
@@ -235,7 +235,7 @@
             #unless already specified with \$(INST_LIB)
             #or already in Apache2/
             unless ($v =~ /Apache2/) {
-                $v =~ s|(blib/lib)|$1/Apache2|;
+                $v =~ s{ (blib[/\\:]lib) }{ catdir($1, 'Apache2')}xe;
             }

             $pm->{$k} = $v;
===============================================================
> > One consideration about this - if someone has a Win32 build
> > under the current system (where some files are under an
> > Apache2/, and others aren't), and then installs a build with
> > a patch like above applied where everything gets put under
> > an Apache2/, there'll be duplicates of some files. I think
> > using Apache2.pm will pick up the newer files installed
> > under an Apache2/, in preference to the older ones which
> > weren't, as @INC will have D:/Perl/site/lib/Apache2 before
> > D:/Perl/site/lib, so that should be OK. However, perhaps we
> > should think about unlinking the old files not under an
> > Apache2/?
>
> Sure, we can arrange that, via the .packlist, like we do
> for Apache::test in Apache::Test. Though it's dangerous.
> Consider the following scenario.
>
> 1) Install a fresh perl
> 2) Install mp2 w/o Apache2
> 3) Install mp1 which now overwrites some of the mp2 files
> 4) Install mp2 w/ Apache2 and uninstall files not under Apache2
>
> results - you will ruin the mp1 install from (3).
>
> In the test suite we make sure that we load files from
> Apache2/ first. Users can do the same, in which case there
> is no problem. There is no problem if someone installs
> into Apache2/ and then decides to install into the main
> @INC.  When this happens Apache2.pm will be rewritten not
> to prepend Apache2 dirs into @INC.
>
> So may be let's just keep it there.

Good idea - I hadn't thought of the above scenario.

-- 
best regards,
randy

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to