perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [MP2] failed to resolve handler `Apache::PerlSections'
Date Sat, 06 Dec 2003 04:38:42 GMT
Stas Bekman wrote:
> Stas Bekman wrote:
> [...]
>> The problem seems to be as following: Apache::Status somehow 
>> autovivifies Apache::PerlSections stash, while Apache/ 
>> wasn't loaded yet. That's why preloading Apache::PerlSections solves 
>> the problem. Our code does not attempt to load packages whose stashes 
>> exist, which is obviously wrong. I'll post a patch soonish. I think 
>> instead of checking for the stash, we need to check %INC.
> It was a bit trickier than I thought, but now the code is even simpler 
> to follow. This should solve your problem Enrico. 'make test' pass 100% 
> with this patch.

So what do you think? Should we go with this change (checking %INC) or not? 
The only drawback I can think of is that if you define a handler without 
loading its package you may need to mess with %INC as in the example below:

PerlModule Loaded
PerlWhateverHandler Loaded::handler
PerlWhateverHandler NotLoaded::handler (which contains Loaded and also NotLoaded packages)
package Loaded;
sub handler {...}
package NotLoaded;
$INC{''} = __FILE__;
sub handler {...}

if %INC is not updated to include the key '', mp2 will try to load, which doesn't exist.

I think it at least gives users more control, rather than having obscure 
problems when an autovivified stash will prevent the package loading. Like in 
the case posted by Enrico.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message