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 16, 2012 14:21
Subject:
Re: Changing the Perl error message when a module is not found
Message ID:
x6fw6hd5pw.fsf@midna.zekjur.net
Hi Jesse,

Jesse Luehrs <doy@tozt.net> writes:
> Needing to handle the case of "module doesn't exist" and "module has
> errors" differently is fairly common. I really don't like the idea of
> "we can't ever change the format of our error messages because people
> might be relying on it", but it is true that as it stands currently,
> this change would break a non-trivial amount of code (base.pm is one
> example I can think of off the top of my head).
Thanks for the example. Note that base.pm uses:

    eval "require $base";
    # Only ignore "Can't locate" errors from our eval require.
    # Other fatal errors (syntax etc) must be reported.
    die if $@ && $@ !~ /^Can't locate .*? at \(eval /;

Which will still work if we only extend the message (see my latest
proposal) and don’t modify its beginning. I hope other code matches
in a similar way.

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