perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [MP2] failed to resolve handler `Apache::PerlSections'
Date Sat, 06 Dec 2003 04:46:31 GMT
Stas Bekman wrote:
> Stas Bekman wrote:
> 
>> Stas Bekman wrote:
>> [...]
>>
>>> The problem seems to be as following: Apache::Status somehow 
>>> autovivifies Apache::PerlSections stash, while Apache/PerlSections.pm 
>>> 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:
> 
> httpd.conf
> ----------
> PerlModule Loaded
> PerlWhateverHandler Loaded::handler
> PerlWhateverHandler NotLoaded::handler
> 
> Loaded.pm (which contains Loaded and also NotLoaded packages)
> ---------
> package Loaded;
> ...
> sub handler {...}
> ...
> package NotLoaded;
> $INC{'NotLoaded.pm'} = __FILE__;
> sub handler {...}
> 1;
> 
> if %INC is not updated to include the key 'NotLoaded.pm', mp2 will try 
> to load NotLoaded.pm, 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.

Or may be we should do the following:

If the package is not loaded (not in %INC), try to load it, but don't bail out 
if it fails (like in the case with Unloaded). Next try to lookup the stash, if 
it's found (which should be the case with Unloaded, since Loaded will load it) 
, then move on, and only if the stash is not found bail out with the loading 
failure error?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message