Subject: | perldoc -m option fails if PAGER environment variable value contains white space |
The -m option to the perldoc command generates an error message if the
value of the PAGER environment variable contains white space; for
example, a value of "less --ignore-case" will cause the error.
In the error case, the "less" pager is invoked before the error message
appears, even if the PAGER environment variable indicates that a
different pager should be used.
The error appears to be due to the fact that the full value of PAGER is
passed as the first argument to a system() call. Possible fixes would
be to pass only the first word, or to split PAGER first and pass all the
words as an array.
Here is a session transcript demonstrating the bug in Pod::Perldoc 3.15;
the failure in version 3.14_02 is the same, but the error message
mentions line 1346 of Perldoc.pm instead of line 1437:
$ uname -a
Linux ala-engtools-dev 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT
2006 i686 i686 i386 GNU/Linux
$ perl -v
This is perl, v5.10.0 built for i686-linux-thread-multi
(with 4 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1004 [287188] provided by ActiveState
http://www.ActiveState.com
Built Sep 3 2008 11:22:08
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$ echo '# Module text.' > foo.pl
$ PAGER='cat' perldoc -m foo.pl
# Module text.
$ PAGER='cat -v' perldoc -m foo.pl
Can't exec "cat -v": No such file or directory at
/folk/tools_test/public/install/activeperl-5.10/i686-pc-linux-gnu/site/lib/Pod/Perldoc.pm
line 1437.
$ perl -MPod::Perldoc -e 'print "$Pod::Perldoc::VERSION\n";'
3.15