Reloading Apache::Registry modules without restarting Apache

"Desilets, Alain" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
I'm using mod_perl on Windows 7, and am trying to set things up so that I can reload my script and all the modules it uses, without having to restart Apache.

The problem is that my script (called webitext.cgi) updates the @INC variable using statements like these:

---
use lib "$ENV{WEBITEXT_HOME}";
use lib "$ENV{WEBITEXT_HOME}/bin";
etc...
---

where the value of $ENV{WEBITEXT_HOME} is set differently depending on the virtual host it's running on. I use this so I can have two versions of my app on the server, a production and a test version, each running under a different vhost which defines the env variable differently (using Apache SetEnv).

The problem is that when Apache::Reload tries to reload the modules, it does not find them, because it seems to use the value of @INC as it was BEFORE the script was run (i.e. not including the ones added with the 'use lib' statements).

This problem occurs whether I use the 'PerlSetVar ReloadTouchFile' approach or the Apache::StatINC approach. It seems to be a well documented limitation of Apache::Reload.

So... I thought about setting the @INC path outside of the script. But I need to do this on a per-vhost basis. According to this page:

http://perl.apache.org/docs/2.0/user/config/config.html#Modifying_C__INC__on_a_Per_VirtualHost

I should be able to do this with something like this:

---
<VirtualHost ...>
      ServerName webitextprod
      PerlOptions +Parent
      PerlSwitches -Idir1 -Idir2 etc...
  </VirtualHost>
---

But when I tried this and ran httpd.exe -t -c httpd.conf, it crashed with the dreaded "free to wrong pool" error:

---
Free to wrong pool 2b60100 not 3d4f10.
---

This error seems to be caused by the PerlOptions +Parent line.

Any suggestion for how to fix or get around this problem would be greatly appreciated.

Thx.

Alain Désilets
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.