perl 5.002beta1h patch: Configure
[p5sagit/p5-mst-13.2.git] / installman
old mode 100644 (file)
new mode 100755 (executable)
index b676563..aab0c22
@@ -27,6 +27,7 @@ $usage =
 
 GetOptions( qw( man1dir=s man1ext=s man3dir=s man3ext=s notify help)) 
        || die $usage;
+die $usage if $opt_help;
 
 # These are written funny to avoid -w typo warnings.
 $man1dir = defined($opt_man1dir) ? $opt_man1dir : $Config{'installman1dir'};
@@ -73,7 +74,7 @@ sub runpod2man {
     # yet. (The user may have set the $install* Configure variables 
     # to point to some temporary home, from which the executable gets
     # installed by occult means.)
-    $pod2man = "../perl -I ../lib ../pod/pod2man";
+    $pod2man = "../perl -I ../lib ../pod/pod2man --section=$manext --official";
 
     &makedir($mandir);
     # Make a list of all the .pm and .pod files in the directory.  We will
@@ -88,8 +89,13 @@ sub runpod2man {
        $manpage =~ s#\.p(m|od)$##;
        $manpage =~ s#/#::#g;
        $manpage = "${mandir}/${manpage}.${manext}";
-       # Print $release $patchlevel stuff?  or should pod2man do that?
        &cmd("$pod2man $mod > $manpage");
+       if (-z $manpage) {
+           print STDERR "unlink $manpage\n";
+           unless ($notify) {
+               unlink($manpage) || warn "cannot unlink $manpage: $!";
+           } 
+       } 
     }
     chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n";
 }
@@ -115,9 +121,10 @@ sub cmd {
     local($cmd) = @_;
     print STDERR "  $cmd\n";
     unless ($notify) {
-       system $cmd;
-       warn "Command failed!!!\n" if $?;
+       fork ? wait : exec $cmd;
+       warn "Command failed!!\n" if $?;
     }
+    return $? != 0;
 }
 
 sub link {