Subject: | 02_module_pod_output.t invokes wrong `perldoc` |
Date: | Sun, 31 Jul 2016 12:10:25 -0400 |
To: | bug-Pod-Perldoc [...] rt.cpan.org |
From: | "A. Sinan Unur" <nanis [...] cpan.org> |
This is similar to https://rt.cpan.org/Public/Bug/Display.html?id=116551
The problem does not just affect Windows systems. Sure, it is most
obvious on those systems, but there is still a problem on Linux and
OSX (the two other platforms I have tried):
In `t/02_module_pod_output.t`, the path to `perldoc` is built as:
my ($volume, $bindir, undef) = File::Spec->splitpath($Bin);
my $perldoc = File::Spec->catpath($volume,$bindir,"perldoc");
This means the `perldoc` script in the source directory is later
attempted to be invoked. There are two problems with invoking this
`perldoc` rather than the one under `blib/script`:
1. It fails on Windows because the whole hash-bang mechanism for
running programs does not work on that platform. This is the problem
reported in RT #116551
2. More subtly, but equally importantly, the test uses `/usr/bin/perl`
and *NOT* the `perl` with which the module is being built.
The solution is to invoke `perldoc` in `blib/script` instead. On
Windows systems, the `perldoc.bat` file will be placed in this
directory. On *nix systems, the shebang line will accurately refer to
the `perl` being used to build and install the module instead of
`/usr/bin/perl` which may be a different version.
my $perldoc = File::Spec->catpath($volume,$bindir,
File::Spec->catfile(qw(blib script perldoc)));
HTH,
-- Sinan
PS: I am also going to submit a pull request.