man3ext = $Config{'man3ext'};
--notify (or -n) just lists commands that would be executed.\n";
-GetOptions( qw( man1dir=s man1ext=s man3dir=s man3ext=s notify n help S))
+GetOptions( qw( man1dir=s man1ext=s man3dir=s man3ext=s notify n help S|silent))
|| die $usage;
die $usage if $opt_help;
$man1ext = defined($opt_man1ext) ? $opt_man1ext : $Config{'man1ext'};
$man3dir = defined($opt_man3dir) ? $opt_man3dir : $Config{'installman3dir'};
$man3ext = defined($opt_man3ext) ? $opt_man3ext : $Config{'man3ext'};
+$silent = defined($opt_silent) ? $opt_silent : 0;
$notify = $opt_notify || $opt_n;
my($builddir) = Cwd::getcwd();
if ($mandir eq ' ' or $mandir eq '') {
- print STDERR "Skipping installation of ",
+ warn "Skipping installation of ",
($script ? "$poddir/$script man page" : "$poddir man pages"), ".\n";
return;
}
- print STDERR "chdir $poddir\n";
+ warn "chdir $poddir\n" unless $silent;
chdir $poddir || die "Unable to cd to $poddir directory!\n$!\n";
# We insist on using the current version of pod2man in case there
}
$tmp = "${mandir}/${manpage}.tmp";
$manpage = "${mandir}/${manpage}.${manext}";
- if (&cmd("$pod2man $mod > $tmp") == 0 && !$notify && -s $tmp) {
+ if (&cmd("$pod2man $mod > $tmp", $mod) == 0 && !$notify && -s $tmp) {
if (rename($tmp, $manpage)) {
$packlist->{$manpage} = { type => 'file' };
next;
}
}
chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n";
- print STDERR "chdir $builddir\n";
+ warn "chdir $builddir\n" unless $silent;
}
sub lsmodpods {
}
$packlist->write() unless $notify;
-print STDERR " Installation complete\n";
+warn " Installation complete\n";
exit 0;
# Utility subroutines from installperl
sub cmd {
- local($cmd) = @_;
- print STDERR " $cmd\n";
+ local($cmd, $mod) = @_;
+ warn "$mod...\n";
+ warn " $cmd\n" unless $silent;
unless ($notify) {
if ($Config{d_fork}) {
fork ? wait : exec $cmd; # Allow user to ^C out of command.
foreach $name (@names) {
next unless -e $name;
chmod 0777, $name if $^O eq 'os2';
- print STDERR " unlink $name\n";
+ warn " unlink $name\n" unless $silent;
( CORE::unlink($name) and ++$cnt
or warn "Couldn't unlink $name: $!\n" ) unless $notify;
}
my($from,$to) = @_;
my($success) = 0;
- print STDERR " ln $from $to\n";
+ warn " ln $from $to\n" unless $silent;
eval {
CORE::link($from, $to)
? $success++
sub chmod {
local($mode,$name) = @_;
- printf STDERR " chmod %o %s\n", $mode, $name;
+ warn( " chmod %o %s\n", $mode, $name) unless $silent;
CORE::chmod($mode,$name) || warn sprintf("Couldn't chmod %o %s: $!\n",$mode,$name)
unless $notify;
}