in reply to Re: Overriding the registry's PERL5LIB in mod_perl on Win32
in thread Overriding the registry's PERL5LIB in mod_perl on Win32

Yes, I was coming round to that sort of idea myself.

What it needs is something to set PERL5LIB in the environment (thus cloaking any nasty registry setting) before the LoadFile directive that loads perl510.dll, but there are no Apache or mod_perl directives to do that.

The nearest that we have is SetEnv and PerlSetEnv, but they just set the environment seen by CGI scripts and mod_perl handlers much later on.

The other idea is simply to rebuild my perl without that horrible registry lookup misfeature in it. It only requires a couple of lines to be deleted from win32/win32.c's win32_getenv(). In fact, in the email thread cited in my original post, Jan Dubois has already suggested actually removing it from perl altogether, so I might just take him up on pursuing that on p5p. (I'll still need to patch my own perl in the meantime, however: I can't wait until 5.12 for a fix.)

  • Comment on Re^2: Overriding the registry's PERL5LIB in mod_perl on Win32

Replies are listed 'Best First'.
Re^3: Overriding the registry's PERL5LIB in mod_perl on Win32
by perrin (Chancellor) on May 21, 2009 at 17:18 UTC
    I have no idea how it works on Windows, but on Linux all you need to do to set PERL5LIB is put it on the command-line when you start apache: PERL5LIB=/my/path apachectl start
      On Win32 Apache is run as a service. The command-line to run is specified in the registry under

      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.2

      In my case this is:

      "C:\apache2.2\bin\httpd.exe" -k runservice

      It isn't as simple as just changing that to something like:

      set PERL5LIB=C:\perl\lib;C:\perl\site\lib && "C:\apache2.2\bin\httpd.exe" -k runservice

      but possibly some kind of wrapper program could be worked in there which sets PERL5LIB and then runs the service.

      I think I'm going to settle for just removing the registry lookup from my perl build, though.