RFC 359 (v1) Improvement needed in error messages (both internal errors and die function).

[email protected] (Perl6 RFC Librarian) 1 Oct 2000 06:36:37 -0000
Newsgroups perl.perl6.language.errors,perl.perl6.announce.rfc
Message-ID <[email protected]>
This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

Improvement needed in error messages (both internal errors and die function).

=head1 VERSION

  Maintainer: S. A. Janet <[email protected]>
  Date: 30 Sep 2000
  Mailing List: [email protected]
  Number: 359
  Version: 1
  Status: Developing

=head1 ABSTRACT

Error messages should contain the word `ERROR' in them.  Messages due
to internal errors should contain `INTERNAL ERROR'.

Error messages should also contain the program name, or if that is not
known, the word `perl'.

=head1 DESCRIPTION

Internal error messages should be improved. For example,

                % perl -le 'print "PRIME" if (1 x shift) !~ /^(11+)\1+$/' 373403020102920303
                Out of memory!

is a poor message. This is better: "perl: FATAL ERROR: out of memory".

=head1 IMPLEMENTATION

This should require very minor improvements to die and the addition of
a function e.g. setprogramname() to register the program name internally:

                % cat foo.pl
                setprogramname( $0 );
                die "filenames expected" if ( $#ARGV < 0 );
                ...
                $ perl foo.pl
                foo.pl: FATAL ERROR: filenames expected

=head1 REFERENCES

None.