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:
Claes Jakobsson
Date:
September 16, 2012 13:21
Subject:
Re: Changing the Perl error message when a module is not found
Message ID:
6057FE21-B836-4ECE-8C2F-7713F6A6DA67@surfar.nu
On 16 sep 2012, at 21:07, Michael Stapelberg <p5p@zekjur.net> wrote:
> Hey,
> 
> I’ve been dealing with people who have little to no experience with
> Perl over several years. A very common problem for people who are new to
> Perl is to figure out why a Perl script does not work when it spits
> something in their face along the lines of
> 
>    Can't locate LWP/UserAgent.pm in @INC (@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. 
>    BEGIN failed--compilation aborted at -e line 1.
> 
> Therefore, as a first step to help people with it, I’ve created
> http://michael.stapelberg.de/cpan/ where I can point people to when they
> encounter this problem and ask for help.
> 
> However, it’d be much better to make Perl itself say something more
> helpful in that situation (many people don’t even ask for support and
> just give up).
> 
> Therefore, what do you think about changing the Perl error message when
> modules are not found to something like this?
> 
>    ERROR: Could not load Perl module LWP::UserAgent
> 
>    I looked for LWP/UserAgent.pm in these paths (@INC):
>    /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
> 
>    Try installing LWP::UserAgent, for example with cpan -i
>    LWP::UserAgent

Changing this quite critical error message format will break peoples code. Tools that checks logs, dependency checkers and perhaps even one or two CPAN clients. At least I had code at a previous job that matched against it and I'm sure others have too.

If this error is going to change I suggest only appending information after it.

however I'm not in favor of changing it as it to me is short and concise.

/Claes


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