Subject: | $Config{pager} string can have arguments |
Date: | Sun, 16 Feb 2020 15:10:17 -0700 |
To: | bug-Pod-Usage [...] rt.cpan.org |
From: | Karl Berry <karl [...] freefriends.org> |
Line 164 of Pod/Usage.pm from perl 5.30.1 is:
system(($Config{pager} || $ENV{PAGER} || '/bin/more'), $1);
On various Unixen, $Config{pager} is typically the string "less -R"
(unless the less is ancient and doesn't support -R). Since perl 5.12 or
so, Perl's Configure script does this (line 2624ff.):
*) if $less -R </dev/null >/dev/null 2>&1; then
echo "Substituting less -R for less."
less="$less -R"
The result is that Pod/Usage.pm system() call looks for the executable
named "less -R", rather than invoking less with the option -R.
I reported this at https://github.com/perl/perl5/issues/16246
and the conclusion is apparently to request the change here.
Of course there are several possible fixes. One suggestion in the above
report was to use the shellwords() function in Text::ParseWords. I can
make up a patch if you like, but I surmised you might prefer some other
approach.
Here is a tiny example program:
use Config;
print "pager: $Config{pager}\n";
$ret = system(($Config{pager} || $ENV{PAGER} || '/bin/more'), "/etc/issue");
print "return: $ret\n";
Given the pager value of "less -R", the return value is -1 and nothing
actually gets executed, so /etc/issue is not shown.
Wdyt? --thanks, karl.