At 6:27 PM -0500 2/19/04, Morbus Iff wrote:
>>You are either getting the wrong module name in some cases, or it is not
>>able to read the module file for some reason.  Just check $@ for the
>>message and find out.
>
> Can't locate LibDB/DB/MySQL.pm in @INC (@INC contains:
> /usr/lib/perl5/5.8.0/i586-linux-thread-multi /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
> /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl . /usr/
> /usr/lib/perl) at (eval 17) line 2. BEGIN failed--compilation
> aborted at (eval 17) line 2. / 14495
>
>which means that %INC isn't being set as I intended,
>since the top of all my .cgi scripts include:
>
>  use lib 'lib';
>  use lib 'extlib';

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.

Workflow wise, this is what happens (I'm writing this down for my
benefit and confirmation; not to chastise you with something you
already know <g>):

 * 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 second time index.cgi is run (this time, WITH a dbconn),
   it tries to eval LibDB:DB::MySQL in. Since this file is not part
   of the default @INC (which now does NOT include my lib/extlib),
   it can't be found. refreshing like mad brings me to a child
   with no cache/reset @INC, and things work just fine.

-- 
Morbus Iff ( united we're bland )
Technical: http://www.oreillynet.com/pub/au/779
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus

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