On Mon, 8 May 2000, Pierre J. Nicolas wrote:
> I've been tyring for the past several days to stop the
> infamous "Undefined Subroutine" messages.  I implemented
> "solution 2" by adding a "require" statement in all of my scripts.
> That still didn't do it.

Why do you have this problem in the first place?  Is it because you have
to use some libraries written in perl4 style, without packages?

> However, I just started using "do" and everything is working fine now.
> I know that "do" unconditionaly re-loads and re-compiles the perl
> script, but I wondering does a script still benefit from "mod_perl"
> if it uses "do" to load the perl libraries that it uses.

You always beenfit from using mod_perl over CGI, because you avoid forking
perl.  However, the speedup from keeping the compiled code in memory is
pretty big, and well worth the trouble on a busy site.

> Also, are the "do" scripts reloaded for each request or is it only once
> per unique script invocation.

They're re-loaded on each request, which is what makes "do" so painful.  
If you really can't change your libraries to use packages (and export
symbols if necessary), you could at least put the do statement inside a
BEGIN block so that it will only happen once per script.  You still waste
memory by loading the same library multiple times, but you do get the
performance benefits.

- Perrin

Reply via email to