Acme-Sort-Sleep
view release on metacpan or search on metacpan
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
# actually a *subclass* of Module::Build, we may need to load that
# subclass here and re-delegate the resume() method to it.
unless ( $package->isa($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;
die(<<"DIEFATAL");
* FATAL ERROR: Perl interpreter mismatch. Configuration was initially
created with '$self->{properties}{perl}'
but we are now using '$perl'. You must
run 'Build realclean' or 'make realclean' and re-configure.
DIEFATAL
}
$self->cull_args(@ARGV);
unless ($self->allow_mb_mismatch) {
my $mb_version = $Module::Build::VERSION;
if ( $mb_version ne $self->{properties}{mb_version} ) {
$self->log_warn(<<"MISMATCH");
* WARNING: Configuration was initially created with Module::Build
version '$self->{properties}{mb_version}' but we are now using version '$mb_version'.
If errors occur, you must re-run the Build.PL or Makefile.PL script.
MISMATCH
}
}
$self->{invoked_action} = $self->{action} ||= 'build';
return $self;
}
sub new_from_context {
my ($package, %args) = @_;
$package->run_perl_script('Build.PL',[],[$package->unparse_args(\%args)]);
return $package->resume;
}
sub current {
# hmm, wonder what the right thing to do here is
local @ARGV;
return shift()->resume;
}
sub _construct {
my ($package, %input) = @_;
my $args = delete $input{args} || {};
my $config = delete $input{config} || {};
my $self = bless {
args => {%$args},
config => Module::Build::Config->new(values => $config),
properties => {
base_dir => $package->cwd,
mb_version => $Module::Build::VERSION,
%input,
},
phash => {},
stash => {}, # temporary caching, not stored in _build
}, $package;
$self->_set_defaults;
my ($p, $ph) = ($self->{properties}, $self->{phash});
foreach (qw(notes config_data features runtime_params cleanup auto_features)) {
my $file = File::Spec->catfile($self->config_dir, $_);
$ph->{$_} = Module::Build::Notes->new(file => $file);
$ph->{$_}->restore if -e $file;
if (exists $p->{$_}) {
my $vals = delete $p->{$_};
foreach my $k (sort keys %$vals) {
$self->$_($k, $vals->{$k});
}
}
}
# 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
# installation process sometimes needs to run external scripts
# (e.g. to run tests).
$p->{perl} = $self->find_perl_interpreter
or $self->log_warn("Warning: Can't locate your perl binary");
my $blibdir = sub { File::Spec->catdir($p->{blib}, @_) };
$p->{bindoc_dirs} ||= [ $blibdir->("script") ];
$p->{libdoc_dirs} ||= [ $blibdir->("lib"), $blibdir->("arch") ];
$p->{dist_author} = [ $p->{dist_author} ] if defined $p->{dist_author} and not ref $p->{dist_author};
# Synonyms
$p->{requires} = delete $p->{prereq} if defined $p->{prereq};
$p->{script_files} = delete $p->{scripts} if defined $p->{scripts};
# Convert to from shell strings to arrays
for ('extra_compiler_flags', 'extra_linker_flags') {
$p->{$_} = [ $self->split_like_shell($p->{$_}) ] if exists $p->{$_};
}
# Convert to arrays
for ('include_dirs') {
$p->{$_} = [ $p->{$_} ] if exists $p->{$_} && !ref $p->{$_}
}
$self->add_to_cleanup( @{delete $p->{add_to_cleanup}} )
if $p->{add_to_cleanup};
return $self;
}
( run in 0.638 second using v1.01-cache-2.11-cpan-39bf76dae61 )