Alien-Selenium
view release on metacpan or search on metacpan
inc/My/Module/Build.pm view on Meta::CPAN
-e => $script, $version, catdir(qw(blib arch)));
warn(join(" ", @cmdline, "\n"));
local %ENV = $self->customize_env(%ENV);
system(@cmdline);
die "Command exited with status " . ($? >> 8) if $?;
# Remove the leftovers again.
do { unlink($_) or die "Cannot unlink($_): $!" } for glob("*.inl");
rmdir("arch");
# Update timestamp
if (! -d (my $stampdir = dirname($stampfile))) {
mkpath($stampdir, 0, 0777)
or die "cannot create directory $stampdir: $!";
}
local *STAMP;
open(STAMP, ">>", $stampfile)
or die "cannot create or update timestamp file $stampfile: $!";
close(STAMP);
utime((time) x 2, $stampfile);
}
=item I<use_blib()>
=item I<use_blib($boolean)>
Returns false if the user specified C<use_blib=0> on the command line,
and true otherwise. See L</Extended C<test> action> for details. The
form with a parameter allows one to set the value that will
subsequently be returned by I<use_blib>, thereby overriding the
command line.
=cut
sub use_blib {
my $self = shift;
if (! @_) {
return 1 if (! exists $self->{args}->{use_blib});
return ! ! $self->{args}->{use_blib};
} else {
$self->{args}->{use_blib} = ! ! shift;
}
}
=back
=head2 Dependent Option Graph Methods
=cut
# These "use" statements are specific to the dependent option graph
# to facilitate refactoring.
use Getopt::Long;
use Carp;
use overload; # for overload::StrVal
=over
=item I<option_value($optionname)>
Returns the value selected for the option $optionname. From within an
option declaration sub, this call may result in the question for
$optionname (and its own dependencies, recursively) being asked on
the terminal at once. If a loop is detected so doing,
I<option_value()> will die with a messsage that starts with the word
"RECURSION".
Answers to questions are persisted using Module::Build's I<< ->notes
>> mechanism: outside the option declaration subs,
I<option_value("foo-bar")> is therefore an alias for
I<notes("option:foo_bar")>.
=cut
sub option_value {
my ($self, $key) = @_;
$key =~ s/-/_/g;
my $noteskey = "option:$key";
my $cached = $self->notes($noteskey);
return $cached if defined $cached;
my $answer = $self->_option_value_nocache($key);
$self->notes($noteskey, $answer);
return $answer;
}
=begin internals
=item I<MODIFY_CODE_ATTRIBUTES($package, $coderef, @attrs)>
Automatically invoked by Perl when parsing subroutine attributes (see
L</attributes>); parses and stores the C<Config_Option> attributes
described in L</Syntax for the option declarations>.
=cut
our %declared_options; our %option_type;
sub MODIFY_CODE_ATTRIBUTES {
my ($package, $coderef, @attrs) = @_;
$coderef = overload::StrVal($coderef);
my @retval;
ATTRIBUTE: foreach my $attr (@attrs) {
unless ($attr =~ m/^\s*Config_Option\s*(?:|\(([^()]*)\))\s*$/) {
push @retval, $attr; # Pass to downstream handlers
next ATTRIBUTE;
}
$declared_options{$coderef}++;
next ATTRIBUTE if ! defined $1; # No keys / values
foreach my $keyval (split qr/\s*,\s*/, $1) {
if ($keyval =~ m/^type\s*=\s*(\S+)\s*$/) {
my $type = $1;
$type =~ s/^"(.*)"$/$1/s;
$type =~ s/^'(.*)'$/$1/s;
my %canonicaltype =
( (map { $_ => "string" } qw(=s string)),
(map { $_ => "integer" } qw(=i int integer)),
(map { $_ => "boolean" } qw(! bool boolean)),
);
defined ($option_type{$coderef} = $canonicaltype{$type})
or die qq'Bad type "$type" in attribute "$attr"';
} else {
die qq'Unknown key "$keyval" in attribute "$attr"';
( run in 0.616 second using v1.01-cache-2.11-cpan-f0fbb3f571b )