You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2004/07/14 23:11:08 UTC

[mp2] adding t/lib to httpd.conf

For making the tests for apr/apr-ext share a common
base under modperl-2.0/t/lib/TestAPRlib/, one must
at present 'use lib q(.....)' in the appropriate
places for both the t/apr/ and t/apr-ext/ tests.
Would the following patch be OK to add this to
httpd.conf, so one doesn't have to repeat it?
===================================================
Index: lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.89
diff -u -r1.89 TestConfigPerl.pm
--- lib/Apache/TestConfigPerl.pm	28 Apr 2004 18:03:41 -0000	1.89
+++ lib/Apache/TestConfigPerl.pm	14 Jul 2004 21:04:28 -0000
@@ -183,6 +183,10 @@
             next unless $_;
             print $fh "use lib '$_';\n";
         }
+        my $tlib = catfile $self->{vars}->{t_dir}, 'lib';
+        if (-d $tlib) {
+            print $fh "use lib '$tlib';\n";
+        }
         my $fixup = Apache::TestConfig->modperl_2_inc_fixup();
         print $fh $fixup;

==============================================================

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] adding t/lib to httpd.conf

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 14 Jul 2004, Stas Bekman wrote:

> Stas Bekman wrote:
> > Randy Kobes wrote:
> >
> >> On Wed, 14 Jul 2004, Randy Kobes wrote:
> >>
> >>> For making the tests for apr/apr-ext share a common
> >>> base under modperl-2.0/t/lib/TestAPRlib/, one must
> >>> at present 'use lib q(.....)' in the appropriate
> >>> places for both the t/apr/ and t/apr-ext/ tests.
> >>> Would the following patch be OK to add this to
> >>> httpd.conf, so one doesn't have to repeat it?
[ ... ]
> or just leave the existing code as it is and just add:
>
> {
>      my $dir = canonpath catdir $FindBin::Bin, "t", "lib";
>      push @dirs, $dir if -d $dir;
> }

Thanks, Stas! I'll do that, and add a note to the Changes.

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] adding t/lib to httpd.conf

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Randy Kobes wrote:
> 
>> On Wed, 14 Jul 2004, Randy Kobes wrote:
>>
>>
>>> For making the tests for apr/apr-ext share a common
>>> base under modperl-2.0/t/lib/TestAPRlib/, one must
>>> at present 'use lib q(.....)' in the appropriate
>>> places for both the t/apr/ and t/apr-ext/ tests.
>>> Would the following patch be OK to add this to
>>> httpd.conf, so one doesn't have to repeat it?
>>
>>
>>
>> I forgot one piece - that to add the t/lib to t/TEST,
>> so that one doesn't have to add it within the t/apr-ext/
>> tests. Here's a version including that:
>> ===================================================
>> Index: lib/Apache/TestConfig.pm
>> ===================================================================
>> RCS file: 
>> /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v 
>>
>> retrieving revision 1.227
>> diff -u -r1.227 TestConfig.pm
>> --- lib/Apache/TestConfig.pm    5 Jul 2004 15:58:00 -0000    1.227
>> +++ lib/Apache/TestConfig.pm    14 Jul 2004 22:08:10 -0000
>> @@ -873,11 +873,13 @@
>>          }
>>      }
>>
>> -    for (qw(. ..)) {
>> -        my $dir = canonpath catdir $FindBin::Bin, $_ , "Apache-Test", 
>> "lib";
>> -        if (-d $dir) {
>> -            push @dirs, $dir;
>> -            last;
>> +    for my $d (qw/Apache-Test t/) {
>> +        for (qw(. ..)) {
>> +            my $dir = canonpath catdir $FindBin::Bin, $_ , $d, "lib";
>> +            if (-d $dir) {
>> +                push @dirs, $dir;
>> +                last;
>> +            }
>>          }
>>      }
> 
> 
> we now always chdir to t/.. before we start. So the '..' part is 
> probably redundant and if there is no t/lib, we will have the same 
> directory Apache-Test/../lib and t/../lib included twice in @INC.

or just leave the existing code as it is and just add:

{
     my $dir = canonpath catdir $FindBin::Bin, "t", "lib";
     push @dirs, $dir if -d $dir;
}


-- 
__________________________________________________________________
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] adding t/lib to httpd.conf

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Wed, 14 Jul 2004, Randy Kobes wrote:
> 
> 
>>For making the tests for apr/apr-ext share a common
>>base under modperl-2.0/t/lib/TestAPRlib/, one must
>>at present 'use lib q(.....)' in the appropriate
>>places for both the t/apr/ and t/apr-ext/ tests.
>>Would the following patch be OK to add this to
>>httpd.conf, so one doesn't have to repeat it?
> 
> 
> I forgot one piece - that to add the t/lib to t/TEST,
> so that one doesn't have to add it within the t/apr-ext/
> tests. Here's a version including that:
> ===================================================
> Index: lib/Apache/TestConfig.pm
> ===================================================================
> RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
> retrieving revision 1.227
> diff -u -r1.227 TestConfig.pm
> --- lib/Apache/TestConfig.pm	5 Jul 2004 15:58:00 -0000	1.227
> +++ lib/Apache/TestConfig.pm	14 Jul 2004 22:08:10 -0000
> @@ -873,11 +873,13 @@
>          }
>      }
> 
> -    for (qw(. ..)) {
> -        my $dir = canonpath catdir $FindBin::Bin, $_ , "Apache-Test", "lib";
> -        if (-d $dir) {
> -            push @dirs, $dir;
> -            last;
> +    for my $d (qw/Apache-Test t/) {
> +        for (qw(. ..)) {
> +            my $dir = canonpath catdir $FindBin::Bin, $_ , $d, "lib";
> +            if (-d $dir) {
> +                push @dirs, $dir;
> +                last;
> +            }
>          }
>      }

we now always chdir to t/.. before we start. So the '..' part is 
probably redundant and if there is no t/lib, we will have the same 
directory Apache-Test/../lib and t/../lib included twice in @INC.


-- 
__________________________________________________________________
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] adding t/lib to httpd.conf

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 14 Jul 2004, Randy Kobes wrote:

> For making the tests for apr/apr-ext share a common
> base under modperl-2.0/t/lib/TestAPRlib/, one must
> at present 'use lib q(.....)' in the appropriate
> places for both the t/apr/ and t/apr-ext/ tests.
> Would the following patch be OK to add this to
> httpd.conf, so one doesn't have to repeat it?

I forgot one piece - that to add the t/lib to t/TEST,
so that one doesn't have to add it within the t/apr-ext/
tests. Here's a version including that:
===================================================
Index: lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.227
diff -u -r1.227 TestConfig.pm
--- lib/Apache/TestConfig.pm	5 Jul 2004 15:58:00 -0000	1.227
+++ lib/Apache/TestConfig.pm	14 Jul 2004 22:08:10 -0000
@@ -873,11 +873,13 @@
         }
     }

-    for (qw(. ..)) {
-        my $dir = canonpath catdir $FindBin::Bin, $_ , "Apache-Test", "lib";
-        if (-d $dir) {
-            push @dirs, $dir;
-            last;
+    for my $d (qw/Apache-Test t/) {
+        for (qw(. ..)) {
+            my $dir = canonpath catdir $FindBin::Bin, $_ , $d, "lib";
+            if (-d $dir) {
+                push @dirs, $dir;
+                last;
+            }
         }
     }

Index: lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.89
diff -u -r1.89 TestConfigPerl.pm
--- lib/Apache/TestConfigPerl.pm	28 Apr 2004 18:03:41 -0000	1.89
+++ lib/Apache/TestConfigPerl.pm	14 Jul 2004 22:08:10 -0000
@@ -183,6 +183,10 @@
             next unless $_;
             print $fh "use lib '$_';\n";
         }
+        my $tlib = catfile $self->{vars}->{t_dir}, 'lib';
+        if (-d $tlib) {
+            print $fh "use lib '$tlib';\n";
+        }
         my $fixup = Apache::TestConfig->modperl_2_inc_fixup();
         print $fh $fixup;

==============================================================

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] adding t/lib to httpd.conf

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> For making the tests for apr/apr-ext share a common
> base under modperl-2.0/t/lib/TestAPRlib/, one must
> at present 'use lib q(.....)' in the appropriate
> places for both the t/apr/ and t/apr-ext/ tests.
> Would the following patch be OK to add this to
> httpd.conf, so one doesn't have to repeat it?

You are reading my mind, Randy :)

Ideally it shouldn't go into Apache-Test, but into mod_perl specific 
config. But I think quite a few people may find t/lib to be useful, so 
+1 for that change

(but please commit from within Apache-Test/ so it'll be posted to the 
right cvs commit list and add a Changes entry. Thanks.)

> ===================================================
> Index: lib/Apache/TestConfigPerl.pm

>              next unless $_;
>              print $fh "use lib '$_';\n";
>          }
> +        my $tlib = catfile $self->{vars}->{t_dir}, 'lib';

I think that should be catdir (though I never could quite figure what's 
the difference between the two, I guess I need to look at the source code :)

> +        if (-d $tlib) {
> +            print $fh "use lib '$tlib';\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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org