sub skip_all {
if (@_) {
- print STDOUT "1..0 - @_\n";
+ print STDOUT "1..0 # Skipped: @_\n";
} else {
print STDOUT "1..0\n";
}
# switches => [ command-line switches ]
# nolib => 1 # don't use -I../lib (included by default)
# prog => one-liner (avoid quotes)
+# progs => [ multi-liner (avoid quotes) ]
# progfile => perl script
# stdin => string to feed the stdin
# stderr => redirect stderr to stdout
sub runperl {
my %args = @_;
my $runperl = $^X;
- if ($args{switches}) {
- _quote_args(\$runperl, $args{switches});
- }
unless ($args{nolib}) {
if ($is_macos) {
$runperl .= ' -I::lib';
$runperl .= ' "-I../lib"'; # doublequotes because of VMS
}
}
+ if ($args{switches}) {
+ _quote_args(\$runperl, $args{switches});
+ }
if (defined $args{prog}) {
- if ($is_mswin || $is_netware || $is_vms) {
- $runperl .= qq( -e ") . $args{prog} . qq(");
- }
- else {
- $runperl .= qq( -e ') . $args{prog} . qq(');
- }
+ $args{progs} = [$args{prog}]
+ }
+ if (defined $args{progs}) {
+ foreach my $prog (@{$args{progs}}) {
+ if ($is_mswin || $is_netware || $is_vms) {
+ $runperl .= qq ( -e "$prog" );
+ }
+ else {
+ $runperl .= qq ( -e '$prog' );
+ }
+ }
} elsif (defined $args{progfile}) {
$runperl .= qq( "$args{progfile}");
}
if (defined $args{stdin}) {
- # so we don't try to put literal newlines and crs onto the
- # command line.
- $args{stdin} =~ s/\n/\\n/g;
- $args{stdin} =~ s/\r/\\r/g;
+ # so we don't try to put literal newlines and crs onto the
+ # command line.
+ $args{stdin} =~ s/\n/\\n/g;
+ $args{stdin} =~ s/\r/\\r/g;
if ($is_mswin || $is_netware || $is_vms) {
$runperl = qq{$^X -e "print qq(} .
$args{stdin} . q{)" | } . $runperl;
}
+ elsif ($is_macos) {
+ # MacOS can only do two processes under MPW at once;
+ # the test itself is one; we can't do two more, so
+ # write to temp file
+ my $stdin = qq{$^X -e 'print qq(} . $args{stdin} . qq{)' > teststdin; };
+ if ($args{verbose}) {
+ my $stdindisplay = $stdin;
+ $stdindisplay =~ s/\n/\n\#/g;
+ print STDERR "# $stdindisplay\n";
+ }
+ `$stdin`;
+ $runperl .= q{ < teststdin };
+ }
else {
$runperl = qq{$^X -e 'print qq(} .
$args{stdin} . q{)' | } . $runperl;
return $result;
}
+*run_perl = \&runperl; # Nice alias.
sub DIE {
print STDERR "# @_\n";
unless (defined $Perl) {
$Perl = $^X;
+ # VMS should have 'perl' aliased properly
+ return $Perl if $^O eq 'VMS';
+
my $exe;
eval "require Config; Config->import";
if ($@) {