Argv
view release on metacpan or search on metacpan
if ($attrs) {
for my $key (keys %$attrs) {
(my $method = $key) =~ s/^-//;
$self->$method($attrs->{$key});
}
}
return $self;
}
# Replace the instance's prog(), opt(), and args() vectors all together.
# Without arguments, return the command as it currently looks either as
# a list or a string depending on context.
sub argv {
my $self = shift;
if (@_) {
$self->attrs(shift) if ref($_[0]) eq 'HASH';
$self->{AV_PROG} = [];
$self->{AV_OPTS}{''} = [];
$self->{AV_ARGS} = [];
$self->prog(shift) if @_;
$self->attrs(shift) if ref($_[0]) eq 'HASH';
s%\\%\\\\%g for @_;
}
return unless MSWIN;
for my $word (@_) {
# If requested, change / for \ in Windows file paths.
# This is necessarily an inexact science.
my @fragments = split ' ', $word;
for (@fragments) {
if (m%^"?/%) {
if (m%(.*/\w+):(.+)%) {
# If it looks like an option specifying a path (/opt:path),
# normalize only the path part.
my($opt, $path) = ($1, $2);
$path =~ s%/%\\%g;
$_ = "$opt:$path";
} else {
# If it contains a slash (any kind) after the initial one
# treat it as a full path. This is where you get into
# ambiguity with combined options (e.g. /E/I/Q/S) which
# could technically be a path. So that's just not allowed
# when path-norming.
( run in 0.398 second using v1.01-cache-2.11-cpan-64827b87656 )