From: Ronald J. Kimball Date: Tue, 13 May 2003 15:13:53 +0000 (-0400) Subject: More perldiag.pod sorting X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f7da1686732e2a80aedec17c9767de6eadacd14;p=p5sagit%2Fp5-mst-13.2.git More perldiag.pod sorting Message-ID: <20030513191353.GB1556429@linguist.thayer.dartmouth.edu> (plus add 'no locale;') p4raw-id: //depot/perl@19516 --- diff --git a/MANIFEST b/MANIFEST index c6c8f92..dff5e79 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2376,6 +2376,7 @@ Porting/patching.pod How to report changes made to Perl Porting/patchls Flexible patch file listing utility Porting/pumpkin.pod Guidelines and hints for Perl maintainers Porting/repository.pod How to use the Perl repository +Porting/sort_perldiag.pl Keep our diagnostics orderly Porting/testall.atom Cumulative profile of the test suite with Third Degree Porting/thirdclean Cleanup Third Degree reports pp.c Push/Pop code diff --git a/Porting/sort_perldiag.pl b/Porting/sort_perldiag.pl new file mode 100644 index 0000000..c4b60ca --- /dev/null +++ b/Porting/sort_perldiag.pl @@ -0,0 +1,90 @@ +#!/usr/local/bin/perl -w + +use strict; + +no locale; + +my %items; +my $item_key; + +$/ = ''; + +while (<>) { + if (/^=item\s+(.+)/) { + # new item + + $item_key = get_item_key($1); + $items{$item_key} .= $_; + + } elsif (/^=back\b/) { + # no more items in this group + + foreach my $item_key (sort keys %items) { + print $items{$item_key}; + } + + $item_key = undef; + %items = (); + + print; + + } elsif (defined $item_key) { + # part of the current item + + $items{$item_key} .= $_; + + } else { + # not part of an item + + print; + + } +} + +if (keys %items) { + warn "Missing =back after final =item.\n"; + + foreach my $item_key (sort keys %items) { + print $items{$item_key}; + } +} + + +# get the sortable key for an item +sub get_item_key { + my($item) = @_; + + # remove POD formatting + $item =~ s/[A-Z]<(.*?)>/$1/g; + + # remove printf-style escapes + # note: be careful not to remove things like %hash + $item =~ s/%(?:[scg]|lx|#o)//g; + + # remove all non-letter characters + $item =~ tr/A-Za-z//cd; + + return lc $item; + +} + +__END__ + +=pod + +=head1 NAME + +sort_perldiag.pl - Sort warning and error messages in perldiag.pod + +=head1 SYNOPSIS + +B I + +=head1 DESCRIPTION + +B is a script for sorting the warning and error +messages in F. POD formatting, printf-style escapes, +non-letter characters, and case are ignored, as explained in L. + +=cut + diff --git a/pod/perldiag.pod b/pod/perldiag.pod index bc16459..c79d68d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -805,16 +805,16 @@ the file, say, by doing C. functioning as a class, but that package doesn't define that particular method, nor does any of its base classes. See L. -=item Can't locate PerlIO%s - -(F) You tried to use in open() a PerlIO layer that does not exist, -e.g. open(FH, ">:nosuchlayer", "somefile"). - =item Can't locate package %s for @%s::ISA (W syntax) The @ISA array contained the name of another package that doesn't seem to exist. +=item Can't locate PerlIO%s + +(F) You tried to use in open() a PerlIO layer that does not exist, +e.g. open(FH, ">:nosuchlayer", "somefile"). + =item Can't make list assignment to \%ENV on this system (F) List assignment to %ENV is not supported on some systems, notably @@ -1953,18 +1953,18 @@ an undefined value for the length. See L. to check the return value of your socket() call? See L. -=item lstat() on filehandle %s - -(W io) You tried to do an lstat on a filehandle. What did you mean -by that? lstat() makes sense only on filenames. (Perl did a fstat() -instead on the filehandle.) - =item Lookbehind longer than %d not implemented in regex; marked by <-- HERE in m/%s/ (F) There is currently a limit on the length of string which lookbehind can handle. This restriction may be eased in a future release. The <-- HERE shows in the regular expression about where the problem was discovered. +=item lstat() on filehandle %s + +(W io) You tried to do an lstat on a filehandle. What did you mean +by that? lstat() makes sense only on filenames. (Perl did a fstat() +instead on the filehandle.) + =item Lvalue subs returning %s not implemented yet (F) Due to limitations in the current implementation, array and hash @@ -2781,15 +2781,15 @@ was string. (P) The compiler attempted to do a goto, or something weird like that. -=item panic: yylex - -(P) The lexer got into a bad state while processing a case modifier. - =item panic: utf16_to_utf8: odd bytelen (P) Something tried to call utf16_to_utf8 with an odd (as opposed to even) byte length. +=item panic: yylex + +(P) The lexer got into a bad state while processing a case modifier. + =item Parentheses missing around "%s" list (W parenthesis) You said something like @@ -3526,6 +3526,10 @@ about where the problem was discovered. See L. (F) While under the C pragma, we cannot switch the real and effective uids or gids. +=item %s syntax + +(F) The final summary message when a C succeeds. + =item syntax error (F) Probably means you had a syntax error. Common reasons include: @@ -3560,10 +3564,6 @@ yourself. a perl4 interpreter, especially if the next 2 tokens are "use strict" or "my $var" or "our $var". -=item %s syntax - -(F) The final summary message when a C succeeds. - =item sysread() on closed filehandle %s (W closed) You tried to read from a closed filehandle. @@ -3844,10 +3844,6 @@ what you are doing you can turn off this warning by C. (F) There are no byte-swapping functions for a machine with this byte order. -=item Unknown "re" subpragma '%s' (known ones are: %s) - -You tried to use an unknown subpragma of the "re" pragma. - =item Unknown open() mode '%s' (F) The second argument of 3-argument open() is not among the list @@ -3861,6 +3857,10 @@ iterating over it, and someone else stuck a message in the stream of data Perl expected. Someone's very confused, or perhaps trying to subvert Perl's population of %ENV for nefarious purposes. +=item Unknown "re" subpragma '%s' (known ones are: %s) + +You tried to use an unknown subpragma of the "re" pragma. + =item Unknown switch condition (?(%.2s in regex; marked by <-- HERE in m/%s/ (F) The condition part of a (?(condition)if-clause|else-clause) construct @@ -3932,6 +3932,11 @@ script, a binary program, or a directory as a Perl program. recognized by Perl inside character classes. The character was understood literally. +=item Unrecognized escape \\%c passed through + +(W misc) You used a backslash-character combination which is not +recognized by Perl. + =item Unrecognized escape \\%c passed through in regex; marked by <-- HERE in m/%s/ (W regexp) You used a backslash-character combination which is not @@ -3940,11 +3945,6 @@ a C<'>-delimited regular expression. The character was understood literally. The <-- HERE shows in the regular expression about where the escape was discovered. -=item Unrecognized escape \\%c passed through - -(W misc) You used a backslash-character combination which is not -recognized by Perl. - =item Unrecognized signal name "%s" (F) You specified a signal name to the kill() function that was not @@ -4142,6 +4142,18 @@ modifier is not presently meaningful in substitutions. use the /g modifier. Currently, /c is meaningful only when /g is used. (This may change in the future.) +=item Use of freed value in iteration (perhaps you modified the iterated array within the loop?) + +(F) This is typically caused by code like the following: + + @a = (3,4); + @a = () for (1,2,@a); + +You are not supposed to modify arrays while they are being iterated over. +For speed and efficiency reasons, Perl internally does not do full +reference-counting of iterated items, hence deleting such an item in the +middle of an iteration causes Perl to see a freed value. + =item Use of *glob{FILEHANDLE} is deprecated (D deprecated) You are now encouraged to use the shorter *glob{IO} form @@ -4206,18 +4218,6 @@ defined B feature. Use an explicit printf() or sprintf() instead. generally because there's a better way to do it, and also because the old way has bad side effects. -=item Use of freed value in iteration (perhaps you modified the iterated array within the loop?) - -(F) This is typically caused by code like the following: - - @a = (3,4); - @a = () for (1,2,@a); - -You are not supposed to modify arrays while they are being iterated over. -For speed and efficiency reasons, Perl internally does not do full -reference-counting of iterated items, hence deleting such an item in the -middle of an iteration causes Perl to see a freed value. - =item Use of -l on filehandle %s (W io) A filehandle represents an opened file, and when you opened the file