Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian Bug#1062398 Lacks dependency on perldoc utility #1832

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading