Alex Harper wrote:

> Hi,
> 
> I'm trying to configure a PerlRequire directive in a <Perl> section of
> an .htaccess file. This is done so that I can have several directories
> (one per VirtualHost) load a different PerlRequire startup without
> resorting to absolute paths for the startup for each VirtualHost.
> 
> Since FindBin doesn't work for much of anything under mod_perl the
> solution I'm trying in the .htaccess file is roughly:
> <Perl>
>       my $dirroot = $0;
>       $dirroot = s/\.htaccess$//;
>       $PerlRequire = $dirroot . "modperlstartup.pl";
> </Perl>
> 
> However this results in the server spinning off into never-never land as
> soon as the first mod_perl enabled CGI from the directory is loaded. If
> I load the PerlRequire outside the perl section (using the exact
> absolute path generated by the code above) everything is fine.
> 
> Does anyone have any suggestions? Is it safe to add a PerlRequire in a
> <Perl> section? I see no mention of it anywhere, but then again I also
> see no examples that do it.
> 
> More generally is there a better/correct way to do this? All the
> examples I can find in Stas Bekman's (excellent BTW) guide always use
> absolute paths for the startup files and any "use lib" pragmas. What I
> really need is a way to modify the path to the startup and the path to
> lib on the basis of the VirtualHost and I'd like to avoid hardcoding the
> paths. 

mod_perl 2.0 has solved these problems already, but it's not in 
production yet :)

Have you read this one?
http://perl.apache.org/guide/config.html#Is_There_a_Way_to_Modify_INC_on
You probably need to use Apache::PerlVINC, but it's not very efficient.

-- 


_____________________________________________________________________
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/


Reply via email to