Stefano wrote:
> Hello,
> 
> I was not able to find anything similar in list archives,
> 
> Trying to :
> 
>       use base Ima::DBI
> 
> in mod_perl (also in a <Perl></Perl> block of config)
> a cought this trace:
> 
>  Uncaught exception from user code:
>       Can't locate DBI/db.pm in @INC (@INC contains: [...]
> 
> 
> This happens because Ima::DBI 'uses' base DBI::db at line 645 of his
> source code and DBI::db is not a package available from @INC but
> directly from the DBI namespace.
> 
> 
> In these cases base.pm (line 42) steps into an unless{} block
> to by-pass 'Can't locate ...' exceptions rised from inside base.pm
> itself:
> 
>       eval "require $base";
>         # Only ignore "Can't locate" errors from our eval require.
>         # Other fatal errors (syntax etc) must be reported.
> ------> die if $@ && $@ !~ /^Can't locate .*? at \(eval /; #'# <------
> 
> 
> Working outside mod_perl (i.e. in a command line perl program) no
> problem jumps out because the above arrowed 'die' correctly matches
> its regexp (the exception message starts at the beginning of the line).
> 
>>From inside mod_perl we have an unmatch so base croaks with the complete
> backtrace and httpd doesn't start (if I pre-use the module) or send
> 500 - Server Error (in a runtime require).
> 
> With the follow substitution it works, but I'm sure there is a better
> and more correct way to behave with.
> 
>     In base.pm :
>     
>     42: <<< die if $@ && $@ !~ /^Can't locate .*? at \(eval /; #'#
>     42: >>> die if $@ && $@ !~ /Can't locate .*? at \(eval /; #'#

Obviously, base.pm should flex it's regex, but this is not an option 
with released perls.

I can think of 2 things:

1. override the problematic subroutine in base.pm so it'll do the right 
thing.

2. preload the module that you pass to 'use base' before loading the 
module that includes 'use base ...'

in any case, please check whether the problem persists in the bleed-perl 
(i.e. 5.9.0-dev) and if so, make sure it gets fixed, by sending a 
bugreport to p5p.


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

Reply via email to