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 /; #'#
Any suggests?
Thanks a lot,
Stefano di Sandro