+sub output {
+ my ($podname, $header, $dochash, $missing, $footer) = @_;
+ my $fh = open_new("pod/$podname.pod", undef,
+ {by => "$0 extracting documentation",
+ from => 'the C source files'});
+
+ 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) {
+ my $section = $dochash->{$key};
+ print $fh "\n=head1 $key\n\n";
+
+ # Output any heading-level documentation and delete so won't get in
+ # the way later
+ if (exists $section->{""}) {
+ print $fh $section->{""} . "\n";
+ delete $section->{""};
+ }
+ print $fh "=over 8\n\n";
+
+ # Again, fallback for determinacy
+ for my $key (sort { uc($a) cmp uc($b) || $a cmp $b } keys %$section) {
+ docout($fh, $key, $section->{$key});
+ }
+ print $fh "\n=back\n";
+ }
+
+ if (@$missing) {
+ print $fh "\n=head1 Undocumented functions\n\n";
+ print $fh $podname eq 'perlapi' ? <<'_EOB_' : <<'_EOB_';
+The following functions have been flagged as part of the public API,
+but are currently undocumented. Use them at your own risk, as the
+interfaces are subject to change. Functions that are not listed in this
+document are not intended for public use, and should NOT be used under any
+circumstances.