Author: kwilliams
Date: Sun Aug 20 19:26:26 2006
New Revision: 6819
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/lib/Module/Build/API.pod
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
Add the 'test_with_blib' parameter
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Sun Aug 20 19:26:26 2006
@@ -17,6 +17,11 @@
the eval() was unsuccessful, rather than continuing blindly on and
dying mysteriously later.
+ - Added a 'test_with_blib' parameter, default true, that lets users
+ avoid adding the blib/ directories to @INC when testing, and
+ therefore lets people run the current regression tests on
+ previously-installed versions of a distribution.
+
0.2805 Sat Jul 29 22:01:24 CDT 2006
- We now embed a copy of version.pm right in the
Modified: Module-Build/trunk/lib/Module/Build/API.pod
==============================================================================
--- Module-Build/trunk/lib/Module/Build/API.pod (original)
+++ Module-Build/trunk/lib/Module/Build/API.pod Sun Aug 20 19:26:26 2006
@@ -715,6 +715,22 @@
property is true, then the C<t/> directory will be scanned recursively
for C<*.t> files.
+
+=item test_with_blib
+
+[version 0.2806]
+
+A boolean parameter, default true, that indicates whether the F<blib/>
+directories will be added to C<@INC> when testing. When set to false,
+this lets users run the current regression tests on
+previously-installed versions of a distribution.
+
+This isn't always guaranteed to work, of course -- some distributions
+might do some fancy stuff during testing, or might explicitly check
+whether the code is being loaded from F<blib/>, or some other thing to
+foil your attempts, but sometimes it can be helpful.
+
+
=item xs_files
[version 0.19]
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Sun Aug 20 19:26:26 2006
@@ -759,6 +759,7 @@
__PACKAGE__->add_property(use_rcfile => 1);
__PACKAGE__->add_property(create_packlist => 1);
__PACKAGE__->add_property(allow_mb_mismatch => 0);
+__PACKAGE__->add_property(test_with_blib => 1);
{
my $Is_ActivePerl = eval {require ActivePerl::DocTools};
@@ -2005,10 +2006,14 @@
$ENV{TEST_VERBOSE},
$ENV{HARNESS_VERBOSE}) = ($p->{verbose} || 0) x 4;
- # Make sure we test the module in blib/
- local @INC = (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'),
- File::Spec->catdir($p->{base_dir}, $self->blib, 'arch'),
- @INC);
+ # Protect others against our @INC changes
+ local @INC = @INC;
+
+ if ($p->{test_with_blib}) {
+ # Make sure we test the module in blib/
+ unshift @INC, (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'),
+ File::Spec->catdir($p->{base_dir}, $self->blib, 'arch'));
+ }
# Filter out nonsensical @INC entries - some versions of
# Test::Harness will really explode the number of entries here
@@ -3932,6 +3937,14 @@
sub do_system {
my ($self, @cmd) = @_;
$self->log_info("@cmd\n");
+
+# my %seen;
+# my $sep = ref($self) ? $self->config('path_sep') : $Config{path_sep};
+# local $ENV{PERL5LIB} = join $sep, grep {
+# ! $seen{$_}++ and -d $_
+# } split($sep, $ENV{PERL5LIB});
+
+
my $status = system(@cmd);
if ($status and $! =~ /Argument list too long/i) {
my $env_entries = '';