Skip to content

Commit

Permalink
Backport the build_class stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
kenahoo committed Jun 9, 2005
1 parent 0fa2eb2 commit ec16d2b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changes
Expand Up @@ -5,6 +5,11 @@ Revision history for Perl extension Module::Build.
- Fix the output of an informational message that we output when
changing the 'shebang line' in installable scripts. [Robin Barker]

- Backported a change from the 0.27_xx branch that keeps track of any
custom Module::Build subclass that might have been created in the
Build.PL script, so that we can reinstantiate the right class in
new_from_context(). [Requested by Jos Boumans]

0.2610 Fri Apr 15 08:25:01 CDT 2005

- new_from_context() was losing its arguments in some cases (and not
Expand Down
20 changes: 19 additions & 1 deletion lib/Module/Build/Base.pm
Expand Up @@ -37,6 +37,21 @@ sub resume {

$self->read_config;

# If someone called Module::Build->current() or
# Module::Build->new_from_context() and the correct class to use is
# actually a *subclass* of Module::Build, we may need to load that
# subclass here and re-delegate the resume() method to it.
unless ( UNIVERSAL::isa($self, $self->build_class) ) {
my $build_class = $self->build_class;
my $config_dir = $self->config_dir || '_build';
my $build_lib = File::Spec->catdir( $config_dir, 'lib' );
unshift( @INC, $build_lib );
unless ( $build_class->can('new') ) {
eval "require $build_class; 1" or die "Failed to re-load '$build_class': $@";
}
return $build_class->resume(@_);
}

unless ($self->_perl_is_same($self->{properties}{perl})) {
my $perl = $self->find_perl_interpreter;
warn(" * WARNING: Configuration was initially created with '$self->{properties}{perl}',\n".
Expand Down Expand Up @@ -98,9 +113,11 @@ sub _construct {
%input,
},
}, $package;

my ($p, $c) = ($self->{properties}, $self->{config});

$p->{build_class} ||= ref $self;

# The following warning could be unnecessary if the user is running
# an embedded perl, but there aren't too many of those around, and
# embedded perls aren't usually used to install modules, and the
Expand Down Expand Up @@ -419,6 +436,7 @@ EOF
# XXX huge hack alert - will revisit this later
my %valid_properties = map {$_ => 1}
qw(
build_class
module_name
dist_name
dist_version
Expand Down

0 comments on commit ec16d2b

Please sign in to comment.