- # Convert name from File/Basename.pm to File::Basename.3 format,
- # if necessary.
- $manpage =~ s#\.p(m|od)$##;
- if ($^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'uwin' || $^O eq 'cygwin') {
- $manpage =~ s#/#.#g;
+ File::Path::mkpath($mandir, $opts{verbose}, 0777) unless $opts{notify};
+
+ foreach my $manpage (sort keys %$modpods) {
+ my $mod = $modpods->{$manpage};
+
+ # Skip files without pod docs
+ my $has_pod;
+ my $fh = open_or_die($mod);
+ while (my $line = <$fh>) {
+ if ($line =~ /^=head1\b/) {
+ ++$has_pod;
+ last;
+ }
+ }
+ close $fh or my_die("close '$mod': $!");
+ # Sadly it doesn't seem possible to re-use this handle for the call
+ # to parse_from_file() below, as Pod::Man relies on source_filename(),
+ # which Pod::Simple only sets accurately if it opens the file itself.
+
+ unless ($has_pod)
+ {
+ warn "no documentation in $mod\n" unless $opts{silent};
+ next;