Module-Build
view release on metacpan or search on metacpan
lib/Module/Build/Base.pm view on Meta::CPAN
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 {
lib/Module/Build/Base.pm view on Meta::CPAN
my $v = $specs->{$k};
# Throw an error if specs conflict with our own.
die "Option specification '$k' conflicts with a " . ref $self
. " option of the same name"
if $self->valid_property($k);
push @specs, $k . (defined $v->{type} ? $v->{type} : '');
push @specs, $v->{store} if exists $v->{store};
$args->{$k} = $v->{default} if exists $v->{default};
}
local @ARGV = @argv; # No other way to dupe Getopt::Long
# Get the options values and return them.
# XXX Add option to allow users to set options?
if ( @specs ) {
Getopt::Long::Configure('pass_through');
Getopt::Long::GetOptions($args, @specs);
}
return $args, @ARGV;
}
hash => { foo => 'bar', bin => 'foo'}
);
can_ok $mb, 'hash';
isa_ok $mb->hash, 'HASH';
is $mb->hash->{foo}, 'bar';
is $mb->hash->{bin}, 'foo';
# Check hash property passed via the command-line.
{
local @ARGV = (
'--hash', 'foo=bar',
'--hash', 'bin=foo',
);
ok $mb = MBSub->new( module_name => $dist->name );
}
can_ok $mb, 'hash';
isa_ok $mb->hash, 'HASH';
is $mb->hash->{foo}, 'bar';
is $mb->hash->{bin}, 'foo';
t/signature.t view on Meta::CPAN
chdir( $mb->dist_dir ) or die "Can't chdir to '@{[$mb->dist_dir]}': $!";
ok !-e 'SIGNATURE', './Build distdir --sign 0 does not sign';
}
eval { $mb->dispatch('realclean') };
is $@, '';
$dist->chdir_in;
{
local @ARGV = '--sign=1';
$dist->change_build_pl({
module_name => $dist->name,
license => 'perl',
auto_configure_requires => 0,
quiet => 1,
});
$dist->regen;
my $mb = Module::Build->new_from_context;
is $mb->{properties}{sign}, 1;
( run in 0.571 second using v1.01-cache-2.11-cpan-49f99fa48dc )