Subject: | "Failed to re-load My::Builder" from a different path |
I recently converted Error.pm and other modules of mine to
Test::Run::Builder which is a subclass of Module::Build with two new
actions. My Build.PL reads:
<<<<<<<<<<<<
use strict;
use warnings;
use File::Spec;
use lib File::Spec->catdir(File::Spec->curdir(), "inc");
use Test::Run::Builder;
my $build = Test::Run::Builder->new(
'module_name' => "Error",
'requires' =>
{
'Scalar::Util' => 0,
},
'license' => "perl",
'dist_abstract' => 'Error/exception handling in an OO-ish way',
'dist_author' => 'Graham Barr <gbarr@pobox.com>',
);
$build->create_build_script;
Show quoted text
And "inc/Test/Run/Builder.pm" is:
<<<<<<<<<<<
package Test::Run::Builder;
use strict;
use warnings;
use Module::Build;
use vars qw(@ISA);
@ISA = (qw(Module::Build));
sub ACTION_runtest
{
my ($self) = @_;
my $p = $self->{properties};
$self->depends_on('code');
local @INC = @INC;
# 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'));
$self->do_test_run_tests;
}
sub ACTION_distruntest {
my ($self) = @_;
$self->depends_on('distdir');
my $start_dir = $self->cwd;
my $dist_dir = $self->dist_dir;
chdir $dist_dir or die "Cannot chdir to $dist_dir: $!";
# XXX could be different names for scripts
$self->run_perl_script('Build.PL') # XXX Should this be run
w/ --nouse-rcfile
or die "Error executing 'Build.PL' in dist directory: $!";
$self->run_perl_script('Build')
or die "Error executing 'Build' in dist directory: $!";
$self->run_perl_script('Build', [], ['runtest'])
or die "Error executing 'Build test' in dist directory";
chdir $start_dir;
}
sub do_test_run_tests
{
my $self = shift;
require Test::Run::CmdLine::Iface;
my $test_run =
Test::Run::CmdLine::Iface->new(
{
'test_files' => [glob("t/*.t")],
}
# 'backend_params' => $self->_get_backend_params(),
);
return $test_run->run();
}
1;
Show quoted text
>>>>>>>>>>>>
>>>>>>>>>>>
Now observe the following sequence of operations:
<<<<<<<<<<<<<<
shlomi:~/progs/perl/cpan/Error/trunk/module$ perl Build.PL
Checking whether your kit is complete...
Looks good
Checking prerequisites...
Looks good
Deleting Build
Removed previous script 'Build'
Creating new 'Build' script for 'Error' version '0.17007'
shlomi:~/progs/perl/cpan/Error/trunk/module$
perl -MModule::Build -e 'print Module::Build->current;'
Failed to re-load 'Test::Run::Builder': Can't locate
Test/Run/Builder.pm in @INC (@INC contains:
_build/lib /home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8//i386-linux /home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8/ /home/shlomi/apps/perl/modules/lib/perl5/5.8.8/i386-linux /home/shlomi/apps/perl/modules/lib/perl5/5.8.8 /usr/lib/perl5/5.8.8/i386-linux /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i386-linux /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.7/i386-linux /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.6/i386-linux /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl .)
at (eval 23) line 1.
Show quoted text>>>>>>>>>>>>>>
This "Module::Builder->current;" command is used by CPAN.pm to
construct the module, and because it fails the module cannot be
installed from CPAN if it's the default. I followed the instructions
here:
http://search.cpan.org/~kwilliams/Module-Build-0.2805/lib/Module/Build/Authoring.pod#SUBCLASSING
And they fail.
Best regards,
Shlomi Fish