[Module-build-checkins] Module-Build/lib/Module/Build Base.pm,1.340.2.31,1.340.2.32
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <kwi...@us...> - 2005-06-09 23:27:27
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3760/lib/Module/Build Modified Files: Tag: release-0_26_branch Base.pm Log Message: Backport the build_class stuff Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.340.2.31 retrieving revision 1.340.2.32 diff -u -d -r1.340.2.31 -r1.340.2.32 --- Base.pm 3 Jun 2005 16:40:04 -0000 1.340.2.31 +++ Base.pm 9 Jun 2005 23:27:17 -0000 1.340.2.32 @@ -37,6 +37,21 @@ $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". @@ -98,9 +113,11 @@ %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 @@ -419,6 +436,7 @@ # XXX huge hack alert - will revisit this later my %valid_properties = map {$_ => 1} qw( + build_class module_name dist_name dist_version |