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: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/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.

__________________________________________________________________
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