Rodent of Unusual Size wrote:
have_module() currently is rather terse when the problem with a perl module is actually with something the module requires or uses. here's a patch which will extract a little more info from $@ if it can, and provide it as part of the message. helpful for tracking down what is *actually* at fault..
well, in the _vast_ majority of cases I would expect the error message to read "Can't locate...". that's the purpose of have_module after all, to ping if the module is there or not.
in the rare cases where the module is there but can't be loaded (such as modules in development) it might be useful to have additional information. but have_module() really isn't there as a development tool - that's what perl -cw is for :)
Seconded.
In addition extra verbosity in the terse mode is not helpful at all, it makes the output hard to read. Especially when you have lots of tests.
I think it's OK to add any extra logging in the verbose mode though (when -verbose is passed) if you find it helpful as a developer. The verbose mode is for developers and for when users have problems, so any extra useful info is a goodness.
nevertheless, it might be useful if you swapped the logic around, adding additional $why only if the error isn't the standard "Can't locate Bar.pm in @INC..."
Yes, I don't quite understand what's the added value of your patch, as you add the extra output when it can't find the file. Where is your supporting email, talks about the opposite case. You probably wanted something like:
$why .= "$@" unless $@ =~ /^Can't locate/;
no?
-- __________________________________________________________________ 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