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:
Michael Stapelberg
Date:
September 17, 2012 00:48
Subject:
Re: Changing the Perl error message when a module is not found
Message ID:
x64nmxcco9.fsf@midna.zekjur.net
Hi Johan,

Johan Vromans <jvromans@squirrel.nl> writes:
> To a novice this might give the impression there are three errors.
>
>    ERROR: Could not load Perl module LWP::UserAgent
>    Can't locate LWP/UserAgent.pm in @INC (@INC contains: ...) at -e line 1. 
>    BEGIN failed--compilation aborted at -e line 1.
>    Try installing module LWP::UserAgent from your distribution or
>    via CPAN. Run 'perldoc perlmodinst' for more information.
I understand and accept your concern, but I don’t think that removing
the newlines and thus creating a block of scary text is a good idea.

> Note that the 2nd line, which is searched for by many tools, is
> unmodified.
As I posted earlier in message <x6fw6hd5pw.fsf@midna.zekjur.net> ¹, such
tools might use /^Can't locate/, not only /Can't locate/ (see the
base.pm example). So we should leave the first line as is and only
append to it.

How about this instead?

    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.

    The above error is most likely caused by Perl not finding the module
    LWP::UserAgent. Try installing LWP::UserAgent from your distribution
    or via CPAN. Run 'perldoc perlmodinst' for more information.

¹ http://thread.gmane.org/gmane.comp.lang.perl.perl5.porters/114613/focus=114629

-- 
Best regards,
Michael

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