On Thu, 2004-02-19 at 18:33, Morbus Iff wrote:
> So, in my case, it appears that eval'ing the module in the .cgi script
> is my only solution, based on this bit from the porting guidelines:
> 
>   When running under mod_perl, once the server is up @INC is frozen
>   and cannot be updated. The only opportunity to temporarily modify
>   @INC is while the script or the module are loaded and compiled for
>   the first time. After that its value is reset to the original one.
>   The only way to change @INC permanently is to modify it at startup.

I actually didn't even realize that, since I always do a "use lib" in my
startup.pl file.

>  * the first time index.cgi is run with no database connection,
>    it loads all the magick modules I "use", save for LibDB::DB::MySQL.
>    it can do this because I've passed 'lib' and 'extlib' to @INC.
>    after the first run, @INC returns to normal (ie. no 'lib'/'extlib').

The only reason it doesn't work the second time is that "use lib 'lib'"
happens at compile time.  It's like a BEGIN block.  To make it happen
every time, you could just do this:

unshift(@INC, qw(lib extlib));

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to