David Golden
Tue, 17 Feb 2009 06:28:00 -0800
On Tue, Feb 17, 2009 at 9:06 AM, Chris 'BinGOs' Williams <ch...@bingosnet.co.uk> wrote: > > In your test I see that you use '-T' switch which makes perl ignore PERL5LIB, > hence the blarting about can't find LWP/RobotUA.pm in @INC. > > Now, I thought CPANPLUS ( which I smoke on ) and CPAN used the same mechanism > during testing, so I'm going to copy this to the cpan-testers-discuss mailing > list > for any further comments.
CPAN.pm does use the same mechanism, but often, CPAN.pm based smokers
have LWP installed already.
More generally, this line in the test file will be a problem for
anyone that uses PERL5LIB, not just smoke testers.
ok(system($^X, '-wTc', File::Spec->catfile('bin', 'checklink')) == 0);
For example, if I'm on a hosted platform, and I use the system perl,
but have CPAN.pm set to install my own additions into ~/myperl/ using
PREFIX or INSTALL_BASE, and I set PERL5LIB to that directory, then
even if I satisfy the LWP dependency, it's installed into a directory
that can't be found under taint mode and would fail this test. Thus,
it's really a bug in the test, not the smoker.
(And that's exactly why smoke testers come in handy -- testing
distributions under a wider range of situations and assumptions than
they were originally developed in.)
As a potential solution for the test file, you should look into how
Test::Harness handles test files. In *.t files that call for taint
mode in the shebang line ("#!/usr/bin/perl -T"), Test::Harness
converts all the PERL5LIB entries into "-I" switches on the command
line when the *.t file is executed. If you want to test 'checklink'
under taint via system(), that's probably a necessary step. See the
source for TAP::Parser::Source::Perl for the code.
Regards,
David