perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christiaan Kras <>
Subject Re: mod_perl lazy loading modules with eval in custom lib
Date Wed, 11 Jul 2007 17:12:19 GMT
Perrin Harkins schreef:
> On 7/11/07, Christiaan Kras <> wrote:
>> I add to @INC with " use lib qw(/my/path) ". All the other modules I
>> load continue to work fine. Just those that use lazy loading fail
>> infrequently.
> Okay, I think I see the problem.  When you change @INC during a
> request, the change only lasts for the length of that one request:
> Because you do a "use lib", @INC is only set the first time you run
> this script.  Change it to this:
> unshift @INC, qw(/my/path/);
> - Perrin
Thanks. I will try that. So basicly, the modules that are loaded at the 
first request will stay in memory, but @INC will get reset?


Wow. I never noticed it. In my app I have runmode that shows me %ENV and 
@INC. At the first request my custom path was in there. And at the 
second request it wasn't. But after a few more requests it's still 
there. Weird behaviour?

Anyway, thanks. I'll try it later on. I'll post again if it doesn't help.

Just a quick note: unshift removes the first record from the array. But 
what if my path isn't in @INC at a second request. That would remove a 
normal path that's always around wouldn't it? Guess I'll just have to 
try and see :-). Thanks.


Christiaan Kras

View raw message