On 30 Jun at 11:13 Clinton Gormley <[EMAIL PROTECTED] > wrote in message
<[EMAIL PROTECTED]>

Thanks, Clint, for your helpful reply.

> Disclaimer: I have never used Apache::Reload, but:
> 
> Apache::Registry already looks for changes to your scripts and reloads
> them as necessary. So you shouldn't need to use both of them.  

Well, I agree it says that, but when I tried using Registry without Reload,
it didn't seem to work, so I gave up, and used Reload, more-or-less
successfully.

[snip]
> 
> Secondly, the problem of it not finding your modules - you need to add a :
> use lib '/path/to/my/modules'; somewhere early on, for instance in a
> startup.pl file that is included in your config, or in one of the first
> lines of your .pl files.
> 
Yeah, well, startup.pl is out of the question if the httpd.conf is
unavailable, and the server can't be restarted. 

My understanding is that adding the "use lib" line is certainly required,
but only takes effect on invocation of the .pl code. If the modules are
already cached, then they are not reloaded. So that's where Apache::Reload
comes in. Any registered modules are stat'ed, and reloaded as necessary
*before* the .pl code are executed, and therefore *before* any "use lib"
instructions are processed. 

So, I would, for instance, have a .pl file which contains
...
use lib ".";    # I believe this is implicit, anyway.
use CCC::MyDBI;
...

Then, if MyDBI.pm contains "use Apache::Reload" (because Apache::ReloadAll
is off), Apache::Reload then registers CCC::MyDBI when it is first compiled.


On subsequent invocations it will look for CCC::MyDBI in @INC. Now, as you
correctly say, I could make a permanent change to @INC in a startup.pl, but
let's agree that's out of the question. 
It would appear, that CCC::MyDBI can't be found in @INC; and I can fix
things (in development) by putting a symlink to CCC/ in any one of the
directories which do appear in @INC, or, for that matter (both in
development and production) in my root. That works well enough, but my
puzzlement derived from seeing "." in @INC; which I had expected to refer to
the project directory, which containc CCC. Apparently not, and I was
wondering why not. 

Personally I would have expected Apache::Reload to have registered the full
path to CCC, which would overcome this problem, but, as I find with so many
other things in PERL, "It don't work that way".

[snip] 
>   PERL5LIB=/home/httpd/perl/extra; export PERL5LIB
> 
> in the script that starts Apache. Alternatively, you can set this
> environment variable in httpd.conf:
> 
>   PerlSetEnv PERL5LIB /home/httpd/perl/extra
> 
Anything that can be set in a .htaccess file is OK, and using the PerlSetEnv
there seems to work. So that's another small step forward, much better than
the symlink in root.

[snip]
> 
> With regards the redefined warnings, what about this:
> 
> use strict; use warnings FATAL => 'all'; no warnings 'redefine';
> 
Yay! that works, too. Thank you.

[snip]
> If you are not able to restart your server, then you need to rely on some
> sort of stat'ing mechanism: Registry for scripts, and Reload for modules.
> A lot of people use this setup successfully.  Just be aware that there may
> be non-obvious issues.
> 
I think that's the pragmatic approach. Abandoning mod_perl now goes against
the grain; I may have to invest in a VPS solution, but I'll see how things
go. 

At least with your help, I have overcome the most immediate ugliness, for
which I'm truly grateful. 

Thanks again, Tony

-- 
Tony van der Hoff        | mailto:[EMAIL PROTECTED]
Buckinghamshire, England

Reply via email to