Skip to content

Commit

Permalink
Merge pull request #1832 from ikedas/debian_bug-1062398 by ikedas
Browse files Browse the repository at this point in the history
Debian Bug#1062398 Lacks dependency on `perldoc` utility
  • Loading branch information
ikedas authored Sep 7, 2024
2 parents c4c9f0f + 1d501b0 commit b9ca7af
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 b9ca7af

Please sign in to comment.