httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: A::T blib vs lib
Date Tue, 21 Oct 2003 18:32:24 GMT
Boris Zentner wrote:
> Hi,
> 
> im subscribed!

And someone has let your previous posts through ;)

> All your hints and tips bring me a step forward, but I stuck on the @INC 
> again. Even with the patch.
> 
> The only thing that pass my brief tests is to change the order of the included 
> path inside TestConfig.pm
> 
> --- TestConfig.pm.orig  2003-10-21 20:49:53.000000000 +0200
> +++ TestConfig.pm       2003-10-21 20:51:20.000000000 +0200
> @@ -1441,7 +1441,7 @@
>      # followed by modperl-2.0/lib (or some other project's lib/),
>      # followed by blib/ and finally system-wide libs.
>      lib::->import(map "$self->{vars}->{top_dir}/$_",
> -                  qw(Apache-Test/lib lib blib/lib blib/arch));
> +                  qw(Apache-Test/lib blib/arch blib/lib lib));
>      #print join "\n", "add_inc", @INC, "";
>  }

There were two more places where lib was unconditionally pushed. And removing 
lib, affected mod_perl 2, so I had to fix that as well. I haven't thoroughly 
tested this change yet, but please try this patch:

Index: lib/Apache/TestConfig.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.179
diff -u -r1.179 TestConfig.pm
--- lib/Apache/TestConfig.pm	20 Oct 2003 22:48:58 -0000	1.179
+++ lib/Apache/TestConfig.pm	21 Oct 2003 19:28:50 -0000
@@ -120,7 +120,7 @@
  sub server { shift->{server} }

  sub modperl_2_inc_fixup {
-    (IS_MOD_PERL_2 && !IS_MOD_PERL_2_BUILD) ? "use Apache2;\n" : '';
+    (IS_MOD_PERL_2 ) ? "use Apache2;\n" : '';
  }

  sub modperl_build_config {
@@ -780,13 +780,19 @@

      require FindBin;

-    # the live 'lib/' dir of the distro (e.g. modperl-2.0/ModPerl-Registry/lib)
-    my @dirs = canonpath catdir $FindBin::Bin, "lib";
+    my @dirs = ();

-    # the live dir of the top dir if any  (e.g. modperl-2.0/lib)
-    if (-e catfile($FindBin::Bin, "..", "Makefile.PL") &&
-        -d catdir($FindBin::Bin, "..", "lib") ) {
-        push @dirs, canonpath catdir $FindBin::Bin, "..", "lib";
+    if ($ENV{APACHE_TEST_LIVE_DEV}) {
+        # the live 'lib/' dir of the distro
+        # (e.g. modperl-2.0/ModPerl-Registry/lib)
+        my $dir = canonpath catdir $FindBin::Bin, "lib";
+        push @dirs, $dir if -d $dir;
+
+        # the live dir of the top dir if any  (e.g. modperl-2.0/lib)
+        if (-e catfile($FindBin::Bin, "..", "Makefile.PL")) {
+            my $dir = canonpath catdir $FindBin::Bin, "..", "lib";
+            push @dirs, $dir if -d $dir;
+        }
      }

      for (qw(. ..)) {
@@ -1442,8 +1448,18 @@
      # make sure that Apache-Test/lib will be first in @INC,
      # followed by modperl-2.0/lib (or some other project's lib/),
      # followed by blib/ and finally system-wide libs.
-    lib::->import(map "$self->{vars}->{top_dir}/$_",
-                  qw(Apache-Test/lib lib blib/lib blib/arch));
+    my $top_dir = $self->{vars}->{top_dir};
+    my @dirs = map { catdir $top_dir, "blib", $_ } qw(lib arch);
+
+    my $apache_test_dir = catdir $top_dir, "Apache-Test";
+    unshift @dirs, $apache_test_dir if -d $apache_test_dir;
+
+    if ($ENV{APACHE_TEST_LIVE_DEV}) {
+        my $lib_dir = catdir $top_dir, "lib";
+        push @dirs, $lib_dir if -d $lib_dir;
+    }
+
+    lib::->import(@dirs);
      #print join "\n", "add_inc", @INC, "";
  }

Index: lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.78
diff -u -r1.78 TestConfigPerl.pm
--- lib/Apache/TestConfigPerl.pm	20 Oct 2003 20:22:56 -0000	1.78
+++ lib/Apache/TestConfigPerl.pm	21 Oct 2003 19:28:50 -0000
@@ -153,7 +153,6 @@
      if (my $inc = $self->{inc}) {
          my $include_pl = catfile $self->{vars}->{t_conf}, 'modperl_inc.pl';
          my $fh = $self->genfile($include_pl);
-        # make sure that the dev libs come before blib
          for (reverse @$inc) {
              print $fh "use lib '$_';\n";
          }

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message