Skip Menu |
 

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 50145
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: dagolden [...] cpan.org
SHLOMIF [...] cpan.org
Cc: brian.d.foy [...] gmail.com
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.36



Subject: "Failed to re-load My::Builder" from a different path
Download (untitled) / with headers
text/plain 3.6k
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
Download (untitled) / with headers
text/plain 319b
On Tue Oct 24 04:30:01 2006, SHLOMIF wrote: Show quoted text
> perl -MModule::Build -e 'print Module::Build->current;'
Yes. If Build.PL adds directories to @INC for its build subclass, these do not get recalled during current() as they would with new_from_context(). perl -Iinc -MModule::Build -e 'print Module::Build->current;'
CC: brian.d.foy [...] gmail.com
Subject: Save @INC additions in config for use in resume()
Download (untitled) / with headers
text/plain 338b
Module::Build->resume() adds _build/lib to @INC for resuming a subclass, but does not add any other directories that might have been added to @INC during Build.PL (e.g. 'inc'). @INC additions should be saved in config and used during resume. Reported by brian d foy: http://www.nntp.perl.org/group/perl.module.build/2009/09/msg2542.html
Patched in trunk


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.