Skip to content

Commit

Permalink
Debian Bug#1062398 Lacks dependency on perl-doc
Browse files Browse the repository at this point in the history
Some distributions (Debian and its descendants) separate perldoc from the package for Perl and replace it with a stub.  Use perldoc only if such stub wouldn't be used.
  • Loading branch information
ikedas committed May 18, 2024
1 parent ea8592c commit 1d501b0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/lib/Sympa/CLI/help.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package Sympa::CLI::help;

use strict;
use warnings;
use Config;
use English qw(-no_match_vars);
use Pod::Usage qw();

Expand All @@ -36,14 +37,31 @@ use constant _options => qw(format|o=s);
use constant _args => qw(command*);
use constant _need_priv => 0;

my $has_perldoc;

BEGIN {
# Some distributions (Debian and its descendants) separate perldoc from
# the package for Perl and replace it with a stub. Use perldoc only if
# such stub wouldn't be used.
my $path = join '/', ($Config{scriptdirexp} || $Config{scriptdir}),
'perldoc';
if (-e $path and open my $pipein, '-|', $path, '-V') {
1 while <$pipein>;
close $pipein;
$has_perldoc = not $CHILD_ERROR;
}
}

my $language = Sympa::Language->instance;

sub _run {
my $class = shift;
my $options = shift;
my @command = @_;

my $noperldoc = 1 unless Sympa::CLI->istty(1) or $options->{format};
my $noperldoc = 1
unless $has_perldoc and (Sympa::CLI->istty(1) or $options->{format});

my $message;

local $ENV{PERLDOC} = sprintf '-o%s', $options->{format}
Expand Down

0 comments on commit 1d501b0

Please sign in to comment.