develooper Front page | perl.perl5.porters | Postings from September 2012

Re: Changing the Perl error message when a module is not found

Thread Previous | Thread Next
From:
Jesse Luehrs
Date:
September 18, 2012 06:35
Subject:
Re: Changing the Perl error message when a module is not found
Message ID:
20120918133508.GT11137@tozt.net
On Tue, Sep 18, 2012 at 08:57:42AM +0200, Aristotle Pagaltzis wrote:
> I think this error message should be a model:
> 
>  $ perl -e'Foo->bar'
>  Can't locate object method "bar" via package "Foo" (perhaps you forgot to load "Foo"?) at -e line 1.
>                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Applied in this case that would be something like this:
> 
>  Can't locate LWP/UserAgent.pm in @INC (perhaps you forgot to install "LWP::UserAgent"?) (@INC contains: /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl .) at -e line 1.
> 
> That also seems to me to insert the advice in such a way as to break the
> least amount of code dependent on the format of this error.
> 
> It’s not a great error message, but I don’t think much better can be
> done in light of the legacy.

+1. I think if nothing else, there's not really any reason not to do
this.

-doy

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About