Goes with lib/open.pm diagnostics changes
[p5sagit/p5-mst-13.2.git] / installman
index d871dc9..360d4f3 100755 (executable)
@@ -77,18 +77,21 @@ pod2man('pod', $opts{man1dir}, $opts{man1ext});
 pod2man('lib', $opts{man3dir}, $opts{man3ext});
 
 # Install the pods embedded in the installed scripts
+my $has_man1dir = $opts{man1dir} ne '' && -d $opts{man1dir};
 open UTILS, "utils.lst" or die "Can't open 'utils.lst': $!";
 while (<UTILS>) {
     next if /^#/;
     chomp;
     $_ = $1 if /#.*pod\s*=\s*(\S+)/;
-    my ($where, $what) = m|^(.*?)/(\S+)|;
+    my ($where, $what) = m|^(\S*)/(\S+)|;
     pod2man($where, $opts{man1dir}, $opts{man1ext}, $what);
-    if (my ($where2, $what2) = m|#.*link\s*=\s*(\S+)/(\S+)|) {
-       my $old = "$opts{man1dir}/$what.$opts{man1ext}";
-       my $new = "$opts{man1dir}/$what2.$opts{man1ext}";
-       unlink($new);
-        link($old, $new);
+    if ($has_man1dir) {
+       if (my ($where2, $what2) = m|#.*link\s*=\s*(\S+)/(\S+)|) {
+           my $old = "$opts{man1dir}/$what.$opts{man1ext}";
+           my $new = "$opts{man1dir}/$what2.$opts{man1ext}";
+           unlink($new);
+           link($old, $new);
+       }
     }
 }