On Tue, 7 Aug 2001, Doug MacEachern wrote:

> On Tue, 7 Aug 2001, Stas Bekman wrote:
>
> > Thinking some more, your solution presented above makes things more
> > explicit, which is probably even cleaner, so I guess my idea should be
> > scratched :)
>
> or add a todo and we can think about it more later.

done

> > If so, can we fix Apache-Test to put all the standard_modules.pl in one
> > place, so we can test virtual hosts with +Parent option?
>
> they already are all in one place, t/conf/modperl_extra.pl

Ok, so I wanted to write a test for Perl{Require|Module}, so I had to add
all this to make 'PerlOptions +Parent' serve requests.

PerlSwitches -Mlib=@serverroot@/lib/parent
PerlModule PerlModuleTest

Listen 8555
<VirtualHost _default_:8555>
    PerlOptions +Parent
    PerlSwitches -Mlib=@serverroot@
    PerlSwitches -Mblib=@serverroot@
    PerlSwitches -Mlib=@serverroot@/lib/vh
    PerlSwitches -Mlib=@serverroot@/hooks
    PerlSwitches -Mlib=@serverroot@/response
    PerlRequire conf/modperl_extra.pl
    PerlModule PerlModuleTest

    <Location /TestModules::dump_env>
      # PerlOptions +GlobalRequest
      SetHandler perl-script
      PerlResponseHandler TestModules::dump_env
    </Location>

</VirtualHost>

it is quite cumbersome :(

Here is the response package:

package TestModules::dump_env;

use strict;
use warnings FATAL => 'all';

sub handler {
    my $r = shift;

    $r->content_type('text/plain');

    my $buffer = '';

    for (@INC) {
        $buffer .= sprintf "%s\n", $_;
    }

    $buffer .= $PerlModuleTest::MAGIC;

    $r->write($buffer);

    0;# Apache::OK;
}

1;
__END__

No corresponding test yet, I was doing it manually:

lwp-request http://localhost:8529/TestModules::dump_env

The two files are:

t/lib/parent/PerlModuleTest.pm
------------------------------
package PerlModuleTest;

$PerlModuleTest::MAGIC = 'Loaded by Parent';

1;
__END__

t/lib/vh/PerlModuleTest.pm
--------------------------
package PerlModuleTest;

$PerlModuleTest::MAGIC = 'Loaded by Virtual Host';

1;
__END__


Now do we really need tests for Perl{Require|Module}? Can anything go
broken with these? As they are pure Perl and don't rely on any
environment.

Doug, you said that .htaccess should support these two directive as well,
but 'eval "expr"' (the way modperl_require is implemented) would be very
inefficient?

In any case, why do we want to support old features that don't make sense?
Or do they? Why would you want this feature in first place?

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to