summaryrefslogtreecommitdiff
path: root/autodoc.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-05-03 07:07:27 -0600
committerKarl Williamson <khw@cpan.org>2022-05-03 08:45:50 -0600
commitd1681de8b59f7c025c48f2bccda485c4ec3ff680 (patch)
tree81324b3119ad5d5c69bdf98b69e56d7e6236dd70 /autodoc.pl
parentb83249756e4513da67807fbc19047223291c94b8 (diff)
downloadperl-d1681de8b59f7c025c48f2bccda485c4ec3ff680.tar.gz
autodoc.pl: Rmv redundant text
When different functions are grouped together in a single entry, some or all of them may be deprecated or experimental. Prior to this commit each such was listed individually as a separate paragraph. It is shorter to say "All forms" if all are of the same ilk, or list just the individual ones in a single sentence, otherwise.
Diffstat (limited to 'autodoc.pl')
-rw-r--r--autodoc.pl58
1 files changed, 46 insertions, 12 deletions
diff --git a/autodoc.pl b/autodoc.pl
index fd0b2fec62..3d4da5f4a6 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -1229,21 +1229,55 @@ sub docout ($$$) { # output the docs for one function group
print $fh "\n";
}
+ my @deprecated;
+ my @experimental;
for my $item (@items) {
- if ($item->{flags} =~ /D/) {
- print $fh <<~"EOT";
+ push @deprecated, "C<$item->{name}>" if $item->{flags} =~ /D/;
+ push @experimental, "C<$item->{name}>" if $item->{flags} =~ /x/;
+ }
- C<B<DEPRECATED!>> It is planned to remove C<$item->{name}> from a
- future release of Perl. Do not use it for new code; remove it from
- existing code.
- EOT
- }
- elsif ($item->{flags} =~ /x/) {
- print $fh <<~"EOT";
+ for my $which (\@deprecated, \@experimental) {
+ if ($which->@*) {
+ my $is;
+ my $it;
+ my $list;
- NOTE: C<$item->{name}> is B<experimental> and may change or be
- removed without notice.
- EOT
+ if ($which->@* == 1) {
+ $is = 'is';
+ $it = 'it';
+ $list = $which->[0];
+ }
+ elsif ($which->@* == @items) {
+ $is = 'are';
+ $it = 'them';
+ $list = (@items == 2)
+ ? "both forms"
+ : "all these forms";
+ }
+ else {
+ $is = 'are';
+ $it = 'them';
+ my $final = pop $which->@*;
+ $list = "the " . join ", ", $which->@*;
+ $list .= "," if $which->@* > 1;
+ $list .= " and $final forms";
+ }
+
+ if ($which == \@deprecated) {
+ print $fh <<~"EOT";
+
+ C<B<DEPRECATED!>> It is planned to remove $list
+ from a future release of Perl. Do not use $it for
+ new code; remove $it from existing code.
+ EOT
+ }
+ else {
+ print $fh <<~"EOT";
+
+ NOTE: $list $is B<experimental> and may change or be
+ removed without notice.
+ EOT
+ }
}
}