Perrin Harkins schreef:
On 7/11/07, Christiaan Kras <[EMAIL PROTECTED]> 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:
http://perl.apache.org/docs/2.0/user/coding/coding.html#Request_localized_Globals

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?

...testing...

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



Reply via email to