summaryrefslogtreecommitdiff
path: root/autodoc.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-06-05 14:58:49 -0600
committerKarl Williamson <khw@cpan.org>2014-06-05 15:22:30 -0600
commitf83c6033e71dad81af816912dd321593b6987890 (patch)
treea3c584a5a3c7e634fae9c73771fef3c340826c29 /autodoc.pl
parentdcccc8ffbf2d700aa062eb88abe7b8cffc41ba48 (diff)
downloadperl-f83c6033e71dad81af816912dd321593b6987890.tar.gz
perlapi: Place in dictionary sort order
Underscores or their lack can confuse people in finding sorted items.
Diffstat (limited to 'autodoc.pl')
-rw-r--r--autodoc.pl14
1 files changed, 10 insertions, 4 deletions
diff --git a/autodoc.pl b/autodoc.pl
index 2bcf263fc0..0b7282d977 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -249,6 +249,14 @@ removed without notice.\n\n$docs" if $flags =~ /x/;
print $fh "=for hackers\nFound in file $file\n\n";
}
+sub sort_helper {
+ # Do a case-insensitive dictionary sort, with only alphabetics
+ # significant, falling back to using everything for determinancy
+ return (uc($a =~ s/[[^:alpha]]//r) cmp uc($b =~ s/[[^:alpha]]//r))
+ || uc($a) cmp uc($b)
+ || $a cmp $b;
+}
+
sub output {
my ($podname, $header, $dochash, $missing, $footer) = @_;
my $fh = open_new("pod/$podname.pod", undef,
@@ -258,8 +266,7 @@ sub output {
print $fh $header;
my $key;
- # case insensitive sort, with fallback for determinacy
- for $key (sort { uc($a) cmp uc($b) || $a cmp $b } keys %$dochash) {
+ for $key (sort sort_helper keys %$dochash) {
my $section = $dochash->{$key};
print $fh "\n=head1 $key\n\n";
@@ -271,8 +278,7 @@ sub output {
}
print $fh "=over 8\n\n";
- # Again, fallback for determinacy
- for my $key (sort { uc($a) cmp uc($b) || $a cmp $b } keys %$section) {
+ for my $key (sort sort_helper keys %$section) {
docout($fh, $key, $section->{$key});
}
print $fh "\n=back\n";