| 
     
      
      
      From: Chris W. <ch...@cw...> - 2001-11-28 15:16:03
      
     
   | 
OpenInteract 1.30 and earlier use a fairly ugly hack to ensure all
modules are available to the webserver. When the server started up,
we'd call OpenInteract::Startup->main_initialize(). For each package
in the site we'd call OI::Startup->process_package(), and this in turn
added both the website package directory and the base installation
package directory to @INC.
With more packages being used, @INC gets pretty hefty -- print it out
from a handler sometime, ouch! There are some performance issues with
this, but they're not too relevant under mod_perl.
Recent changes to OpenInteract::ApacheStartup moved the
main_initialize() call from the server startup to the ChildInit
handler. And since you can't permanently modify @INC from anything
except PerlRequire/PerlModule, none of our modules were accessible.
My fix is to create at server startup a temporary library directory
and copy to it all relevant files from the website and base
installation directories. ('Relevant files' right now means anything
ending in '.pm', but that's easily fixed.)
Once created, we just add that single directory to @INC and we're
rolling. I've tested this out and it seems to work fine.
So my question (finally): does anyone see any issues with this?  The
only one I can think of is that there is some slight overhead copying
all the files at startup, but it's mimimal and probably offset (and
then some) by the overhead imposed by the old monster @INC.
Thanks,
Chris
-- 
Chris Winters (ch...@cw...)
Building enterprise-capable snack solutions since 1988.
 |