On Sat, 2004-02-21 at 20:43, Morbus Iff wrote:
> Well, without the BEGIN, running it as a normal CGI script failed entirely,
> with the scripts not being able to find the modules.

Hmm.  You must have some things inside a BEGIN or that are called from a
"use" that need these libs to be in @INC during the compile phase.

> Throwing it into a
> BEGIN worked immediately thereafter, but I've not *extensively* tested
> it out under mod_perl yet. And yes, I'm attempting under Registry.

Because Registry caches your script, it only runs the BEGIN block the
first time the script gets compiled, and then again if you modify the
script.  PerlRun executes BEGIN blocks every time because it recompiles
your script every time.  So, if that stuff in the guide about @INC being
frozen is correct, I would expect that your BEGIN block solution would
only modify @INC on the first request when running under Registry.

More to the point, I would expect you to have the same problem that you
had with "use lib" because you're really doing the same thing that use
lib does.  I'd suggest testing it more before you consider it solved.

By the way, it's pretty reasonable to expect that someone who intends to
run your code under mod_perl will be able to either add a use lib
statement to httpd.conf or put your libs in <APCHE_HOME>/lib/perl/ which
is automatically added to @INC.  Both of those avoid this issue
completely.

- 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