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 Mon, 20 Oct 2003 03:36:00 GMT
Stas Bekman wrote:

> We discussed with Boris offline that we want to change the current 
> behavior of A::T, where it puts lib/ as the first entry in @INC. We 
> agreed to have a special maintainer mode (Env var/option) which will 
> turn on the current behavior, and by default blib/ dirs are to be first 
> in @INC.

Sorry for taking that long. Please try the patch at the end of this message.

Is everybody happy with the name of the env var APACHE_TEST_LIVE_DEV, when 
when set to 1, will prepend the project/lib directory to @INC and otherwise 
won't do anything special about it. e.g. in the new Apache::VMonitor dir:

   % env t/TEST -conf

produces t/conf/modperl_inc.pl:

use lib '/home/stas/work/modules/Apache-VMonitor-2.0/blib/arch';
use lib '/home/stas/work/modules/Apache-VMonitor-2.0/blib/lib';
use Apache2;
1;

and:

% env APACHE_TEST_LIVE_DEV=1 t/TEST -conf

produces t/conf/modperl_inc.pl:

use lib '/home/stas/work/modules/Apache-VMonitor-2.0/blib/arch';
use lib '/home/stas/work/modules/Apache-VMonitor-2.0/blib/lib';
use Apache2;
use lib '/home/stas/work/modules/Apache-VMonitor-2.0/lib';
1;

(It was broken before anyway, since 'use Apache2' was loaded last, pushing 
'lib' down.)

Index: lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.77
diff -u -r1.77 TestConfigPerl.pm
--- lib/Apache/TestConfigPerl.pm	7 Oct 2003 17:44:58 -0000	1.77
+++ lib/Apache/TestConfigPerl.pm	20 Oct 2003 04:29:28 -0000
@@ -81,9 +81,8 @@
      my $top = $self->{vars}->{top_dir};

      my $inc = $self->{inc};
-    my @trys = (catfile($top, 'lib'),
-                catfile($top, qw(blib lib)),
-                catfile($top, qw(blib arch)));
+    my @trys = (catdir($top, qw(blib lib)),
+                catdir($top, qw(blib arch)));

      for (@trys) {
          push @$inc, $_ if -d $_;
@@ -160,6 +159,14 @@
          }
          my $fixup = Apache::TestConfig->modperl_2_inc_fixup();
          print $fh $fixup;
+
+        # if Apache::Test is used to develop a project, we want the
+        # project/lib directory to be first in @INC (loaded last)
+        if ($ENV{APACHE_TEST_LIVE_DEV}) {
+            my $dev_lib = catdir $self->{vars}->{top_dir}, "lib";
+            print $fh "use lib '$dev_lib';\n" if -d $dev_lib;
+        }
+
          print $fh "1;\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