Geoffrey Young wrote:
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.


yeah, that's a good idea.


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/;


ken and I talked about this over irc.  the issues he had seemed to stem from
the fact that the error thrown from use() isn't always intuitive to non-perl
folks.  specifically, the error message from have_module is 'couldn't find
module' which is a bit misleading - in many cases perl can "find" the module
just fine, but it can't be used due to missing dependencies (ken's current
problem).

so, I'd suggest making the the have_module message a bit clearer, maybe
something like 'module $module not available' or somesuch.

also, ken pointed out that $@ will contain "Can't locate Bar.pm in @INC" if
you use() Foo.pm and Foo.pm use()s Bar.pm and Bar.pm is missing.  so

  $@ =~ /^Can't locate/;

should probably be something like

  $@ =~ /^Can't locate $module/;

or somesuch, so that a missing Foo.pm is not reported verbosely, but a
missing Bar.pm is.

Understood.

then again, if the current behavior can be maintained and $@ printed only in
-verbose mode you don't really need a regex at all.

All, but the case when it can't find a file. In which case $@ is too big to print, usually it can go up to 10 lines listing tons of dirs in @INC.


There should be a clear distinction between the module is not there -- we don't want any errors printed out at all (that's why we use have_module() and not just require) and the module is there but something goes wrong, in which case an explanation is due.

I didn't participate in the discussion, but may be Ken should use require instead of have_module(), at least while developing. Dunno if that's what he is after.


-- __________________________________________________________________ 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