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:
Smylers
Date:
September 18, 2012 02:27
Subject:
Re: Changing the Perl error message when a module is not found
Message ID:
20120918092746.GL1846@stripey.com
Nicholas Clark writes:

> On Tue, Sep 18, 2012 at 07:23:14AM +0100, Smylers wrote:
> 
> > As a non-novice, I'd still be grateful for the error message to
> > include the Module::Name rather than just Module/Name.pm. Apart from
> > anything else it makes it copy-and-pastable to, for example, a cpanm
> > command -- even though that isn't always what I want to do.
> 
> That's the one change that I think it would be unambiguously useful to
> add. However, it's not trivially obvious how to do it, as the
> conversion from Module::Name to Module/Name.pm is done at compile time
> ...

I think the suggestion was simply for it to be converted back again in
the error message: if the file not found ends in .pm then lop that off
the end and replace /s with ::s.

This would mean it shows even in situations where somebody had done
require 'Some/File.pm' -- but that's a much rarer case and somebody
doing that is more likely to know what she's doing and realize that
Some::File doesn't apply.

Cheers

Smylers
-- 
New series of TV puzzle show 'Only Connect' (some questions by me)
Mondays at 20:30 on BBC4, or iPlayer: http://www.bbc.co.uk/onlyconnect

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