http://www.perlmonks.org?node_id=539773


in reply to Dynamic @INC under mod_perl2 (Apache2 VirtualHost)

You almost have it. You also need the Parent option. See the docs for more info.

<VirtualHost ...> ServerName dev PerlOptions +Parent PerlSwitches -Mlib=/home/dev/lib/perl </VirtualHost> <VirtualHost ...> ServerName test PerlOptions +Parent PerlSwitches -Mlib=/home/test/lib/perl </VirtualHost>

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: Dynamic @INC under mod_perl2 (Apache2 VirtualHost)
by ikegami (Patriarch) on Mar 28, 2006 at 18:37 UTC

    Keeping in mind the important piece of info in the parent post is PerlOptions +Parent, the docs also say -Mlib=... is buggy on certain platforms. -I... does the same thing, except it doesn't remove duplicates (which is no biggy). Therefore, he should keep his -I... and simply add PerlOptions +Parent, as follows:

    <VirtualHost ...> ServerName dev PerlOptions +Parent PerlSwitches -I/home/dev/lib/perl </VirtualHost> <VirtualHost ...> ServerName test PerlOptions +Parent PerlSwitches -I/home/test/lib/perl </VirtualHost>

    I presume his LoadModule needs to be placed in <VirtualHost> for it to work?

      Thank you - I am making progress.

      I've setup Apache to listen on port 8080 and Included VH config file like so:

      But I get this error, despite my best efforts:
      Can't locate object method "log_error" via package "Apache2::RequestRe +c" at /home/graq/lib/GRAQ/Menu.pm line 56.

      This all used to work with liberal smatterings of <Perl> use lib 'home/graq/lib';</Perl> and I'm getting a little lost on exactly what effects my changes have had on the mod_perl environment.

      I remember having this error when porting from mp1 to mp2, but can't find any notes on it or hints from the docs on what object I should have in handler...?

      -=( Graq )=-
        Looking through the Apache2::RequestRec documentation shows that log_error actually exists on Apache2::Log (which extends Apache2::RequestRec).

        For whatever reason, that extension was not loaded with the new configuration. Adding use Apache2::Log; to my modules fixed the problem.

        Thank you all for your help

        -=( Graq )=-