if($opts{-script}) {
require Config;
- push(@search, $Config::Config{scriptdir});
+ push(@search, $Config::Config{scriptdir})
+ if -d $Config::Config{scriptdir};
$opts{-perl} = 1;
}
if($opts{-inc}) {
- push(@search, grep($_ ne '.',@INC));
+ if ($^O eq 'MacOS') {
+ # tolerate '.', './some_dir' and '(../)+some_dir' on Mac OS
+ my @new_INC = @INC;
+ for (@new_INC) {
+ if ( $_ eq '.' ) {
+ $_ = ':';
+ } elsif ( $_ =~ s|^((?:\.\./)+)|':' x (length($1)/3)|e ) {
+ $_ = ':'. $_;
+ } else {
+ $_ =~ s|^\./|:|;
+ }
+ }
+ push(@search, grep($_ ne File::Spec->curdir, @new_INC));
+ } else {
+ push(@search, grep($_ ne File::Spec->curdir, @INC));
+ }
+
$opts{-perl} = 1;
}
# * remove e.g. "i586-linux" (from 'archname')
# * remove e.g. 5.00503
# * remove pod/ if followed by *.pod (e.g. in pod/perlfunc.pod)
- $SIMPLIFY_RX =
- qq!^(?i:site(_perl)?/|\Q$Config::Config{archname}\E/|\\d+\\.\\d+([_.]?\\d+)?/|pod/(?=.*?\\.pod\\z))*!;
+ # Mac OS:
+ # * remove ":?site_perl:"
+ # * remove :?pod: if followed by *.pod (e.g. in :pod:perlfunc.pod)
+
+ if ($^O eq 'MacOS') {
+ $SIMPLIFY_RX =
+ qq!^(?i:\:?site_perl\:|\:?pod\:(?=.*?\\.pod\\z))*!;
+ } else {
+ $SIMPLIFY_RX =
+ qq!^(?i:site(_perl)?/|\Q$Config::Config{archname}\E/|\\d+\\.\\d+([_.]?\\d+)?/|pod/(?=.*?\\.pod\\z))*!;
+ }
}
my %dirs_visited;
}
next;
}
- my $root_rx = qq!^\Q$try\E/!;
+ my $root_rx = $^O eq 'MacOS' ? qq!^\Q$try\E! : qq!^\Q$try\E/!;
File::Find::find( sub {
my $item = $File::Find::name;
if(-d) {
$name =~ s!$SIMPLIFY_RX!!os if(defined $SIMPLIFY_RX);
}
else {
- $name =~ s:^.*/::s;
+ if ($^O eq 'MacOS') {
+ $name =~ s/^.*://s;
+ } else {
+ $name =~ s:^.*/::s;
+ }
}
_simplify($name);
$name =~ s!/+!::!g; #/
+ if ($^O eq 'MacOS') {
+ $name =~ s!:+!::!g; # : -> ::
+ } else {
+ $name =~ s!/+!::!g; # / -> ::
+ }
$name;
}
sub simplify_name {
my ($str) = @_;
# remove all path components
- $str =~ s:^.*/::s;
+ if ($^O eq 'MacOS') {
+ $str =~ s/^.*://s;
+ } else {
+ $str =~ s:^.*/::s;
+ }
_simplify($str);
$str;
}
my %options = (
'-inc' => 0,
'-verbose' => 0,
- '-dirs' => [ '.' ],
+ '-dirs' => [ File::Spec->curdir ],
);
# Check for an options hash as first argument
require Config;
# Add @INC
- push (@search_dirs, @INC) if $options{'-inc'};
+ if ($^O eq 'MacOS' && $options{'-inc'}) {
+ # tolerate '.', './some_dir' and '(../)+some_dir' on Mac OS
+ my @new_INC = @INC;
+ for (@new_INC) {
+ if ( $_ eq '.' ) {
+ $_ = ':';
+ } elsif ( $_ =~ s|^((?:\.\./)+)|':' x (length($1)/3)|e ) {
+ $_ = ':'. $_;
+ } else {
+ $_ =~ s|^\./|:|;
+ }
+ }
+ push (@search_dirs, @new_INC);
+ } elsif ($options{'-inc'}) {
+ push (@search_dirs, @INC);
+ }
# Add location of pod documentation for perl man pages (eg perlfunc)
# This is a pod directory in the private install tree
# Loop over directories
Dir: foreach my $dir ( @search_dirs ) {
- # Don't bother if cant find the directory
+ # Don't bother if can't find the directory
if (-d $dir) {
warn "Looking in directory $dir\n"
if $options{'-verbose'};
}
use Config;
-if ( ($Config{'cppstdin'} =~ /\bcppstdin\b/) &&
+if ( $^O eq 'MacOS' ||
+ ($Config{'cppstdin'} =~ /\bcppstdin\b/) &&
! -x $Config{'binexp'} . "/cppstdin" ) {
print "1..0 # Skip: \$Config{cppstdin} unavailable\n";
exit; # Cannot test till after install, alas.
print STDERR "ok 3\n";
# Since some systems don't have echo, we use Perl.
-$echo = qq{$^X -le "print q{ok %d}"};
+$echo = qq{$^X -le "print q(ok %d)"};
-$cmd = sprintf $echo, 4;
+$cmd = sprintf $echo, 4;
print `$cmd`;
-$cmd = sprintf "$echo 1>&2", 5;
+$cmd = sprintf "$echo 1>&2", 5;
+$cmd = sprintf $echo, 5 if $^O eq 'MacOS'; # don't know if we can do this ...
print `$cmd`;
# KNOWN BUG system() does not honor STDOUT redirections on VMS.
}
else {
system sprintf $echo, 6;
- system sprintf "$echo 1>&2", 7;
+ if ($^O eq 'MacOS') {
+ system sprintf $echo, 7;
+ }
+ else {
+ system sprintf "$echo 1>&2", 7;
+ }
}
close(STDOUT) or die "Could not close: $!";
open(STDERR,">&DUPERR") or die "Could not open: $!";
if (($^O eq 'MSWin32') || ($^O eq 'NetWare') || ($^O eq 'VMS')) { print `type Io.dup` }
-else { system 'cat Io.dup' }
+elsif ($^O eq 'MacOS') { system 'catenate Io.dup' }
+else { system 'cat Io.dup' }
unlink 'Io.dup';
print STDOUT "ok 8\n";
}
use Config;
+use File::Spec::Functions;
+my $Is_MacOS = ($^O eq 'MacOS');
my $Is_VMSish = ($^O eq 'VMS');
if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) {
!($^O eq 'MSWin32' || $^O eq 'NetWare' ||
$^O eq 'dos' || $^O eq 'os2' ||
$^O eq 'mint' || $^O eq 'cygwin' ||
- $^O eq 'amigaos' || $wd =~ m#$Config{afsroot}/#
+ $^O eq 'amigaos' || $wd =~ m#$Config{afsroot}/# ||
+ $Is_MacOS
);
if (defined &Win32::IsWinNT && Win32::IsWinNT()) {
if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) {
`rmdir /s /q tmp 2>nul`;
`mkdir tmp`;
-} elsif ($^O eq 'VMS') {
+}
+elsif ($^O eq 'VMS') {
`if f\$search("[.tmp]*.*") .nes. "" then delete/nolog/noconfirm [.tmp]*.*.*`;
`if f\$search("tmp.dir") .nes. "" then delete/nolog/noconfirm tmp.dir;`;
`create/directory [.tmp]`;
}
+elsif ($Is_MacOS) {
+ rmdir "tmp"; mkdir "tmp";
+}
else {
`rm -f tmp 2>/dev/null; mkdir tmp 2>/dev/null`;
}
-chdir './tmp';
+chdir catdir(curdir(), 'tmp');
`/bin/rm -rf a b c x` if -x '/bin/rm';
umask(022);
SKIP: {
- skip "bogus umask", 1 if ($^O eq 'MSWin32') || ($^O eq 'NetWare') || ($^O eq 'epoc');
+ skip "bogus umask", 1 if ($^O eq 'MSWin32') || ($^O eq 'NetWare') || ($^O eq 'epoc') || $Is_MacOS;
is((umask(0)&0777), 022, 'umask'),
}
`perl -le "print 'foo'" > .b`;
`perl -le "print 'foo'" > .c`;
}
+elsif ($^O eq 'MacOS') {
+ $CAT = "$^X -e \"print<>\"";
+ `$^X -le "print 'foo'" > .a`;
+ `$^X -le "print 'foo'" > .b`;
+ `$^X -le "print 'foo'" > .c`;
+}
elsif ($^O eq 'VMS') {
$CAT = 'MCR []perl. -e "print<>"';
`MCR []perl. -le "print 'foo'" > ./.a`;
`MCR []perl. -le "print 'foo'" > ./.b`;
`MCR []perl. -le "print 'foo'" > ./.c`;
}
+elsif ($^O eq 'MacOS') {
+ $CAT = "$^X -e \"print<>\"";
+ `$^X -le "print 'foo'" > .a`;
+ `$^X -le "print 'foo'" > .b`;
+ `$^X -le "print 'foo'" > .c`;
+}
else {
$CAT = 'cat';
`echo foo | tee .a .b .c`;
use warnings;
use Config;
$Is_VMS = $^O eq 'VMS';
+$Is_MacOS = $^O eq 'MacOS';
plan tests => 94;
skip "open -| busted and noisy on VMS", 3 if $Is_VMS;
ok( open(my $f, '-|', <<EOC), 'open -|' );
- $Perl -e "print qq(a row\n); print qq(another row\n)"
+ $Perl -e "print qq(a row\\n); print qq(another row\\n)"
EOC
my @rows = <$f>;
ok( close($f), ' close' );
}
-{
+SKIP: {
+ skip "Output for |- doesn't go to shell on MacOS", 5 if $Is_MacOS;
+
ok( open(my $f, '|-', <<EOC), 'open |-' );
$Perl -pe "s/^not //"
EOC
skip "open -| busted and noisy on VMS", 3 if $Is_VMS;
ok( open(local $f, '-|', <<EOC), 'open local $f, "-|", ...' );
- $Perl -e "print qq(a row\n); print qq(another row\n)"
+ $Perl -e "print qq(a row\\n); print qq(another row\\n)"
EOC
my @rows = <$f>;
ok( close($f), ' close' );
}
-{
+SKIP: {
+ skip "Output for |- doesn't go to shell on MacOS", 5 if $Is_MacOS;
+
ok( open(local $f, '|-', <<EOC), 'open local $f, "|-", ...' );
$Perl -pe "s/^not //"
EOC
require './test.pl';
}
-if ($^O eq 'dos') {
+if ($^O eq 'dos' || $^O eq 'MacOS') {
skip_all("no multitasking");
}
undef &skip;
}
+skip_all "Unhappy on MacOS" if $^O eq 'MacOS';
+
#
# ./test.pl does real evilness by jumping to a label.
# This function copies the skip from ./test, omitting the goto.
{
my $datafile = "datatmp000";
1 while -f ++ $datafile;
- END {unlink_all $datafile}
+ END {unlink_all $datafile if $datafile}
open MY_DATA, "> $datafile" or die "Failed to open $datafile: $!";
print MY_DATA << " --";
{
my $progfile = "progtmp000";
1 while -f ++ $progfile;
- END {unlink_all $progfile}
+ END {unlink_all $progfile if $progfile}
my @programs = (<< ' --', << ' --');
#!./perl
use strict;
use warnings;
+use File::Spec::Functions;
# Okay, this is the list.
sub compile_module {
my ($module) = $_[0];
- my $out = scalar `$^X "-I../lib" lib/compmod.pl $module`;
+ my $compmod = catfile(curdir(), 'lib', 'compmod.pl');
+ my $lib = '-I' . catdir(updir(), 'lib');
+
+ my $out = scalar `$^X $lib $compmod $module`;
print "# $out";
return $out =~ /^ok/;
}
#!./perl
BEGIN {
- chdir '..' if -d '../pod' && -d '../t';
- @INC = 'lib';
+ chdir 't';
+ @INC = '../lib';
}
my $module = shift;
require "test.pl";
plan(tests => 31);
-my $IsVMS = $^O eq 'VMS';
+my $IsVMS = $^O eq 'VMS';
+my $IsMacOS = $^O eq 'MacOS';
# Might be a little early in the testing process to start using these,
# but I can't think of a way to write this test without them.
my($key) = @_;
# Make sure $ENV{'SYS$LOGIN'} is only honored on VMS.
- if( $key eq 'SYS$LOGIN' && !$IsVMS ) {
+ if( $key eq 'SYS$LOGIN' && !$IsVMS && !$IsMacOS ) {
ok( !chdir(), "chdir() on $^O ignores only \$ENV{$key} set" );
is( abs_path, $Cwd, ' abs_path() did not change' );
pass( " no need to test SYS\$LOGIN on $^O" ) for 1..7;
next if $IsVMS && $env eq 'SYS$LOGIN';
next if $IsVMS && $env eq 'HOME' && !$Config{'d_setenv'};
- # On VMS, %ENV is many layered.
- delete $ENV{$env} while exists $ENV{$env};
+ unless ($IsMacOS) { # ENV on MacOS is "special" :-)
+ # On VMS, %ENV is many layered.
+ delete $ENV{$env} while exists $ENV{$env};
+ }
}
# The following means we won't really be testing for non-existence,
{
clean_env;
- if ($IsVMS && !$Config{'d_setenv'}) {
+ if (($IsVMS || $IsMacOS) && !$Config{'d_setenv'}) {
pass("Can't reset HOME, so chdir() test meaningless");
} else {
ok( !chdir(), 'chdir() w/o any ENV set' );
my $Is_VMS = $^O eq 'VMS';
my $Is_Win32 = $^O eq 'MSWin32';
+skip_all("Tests mostly usesless on MacOS") if $^O eq 'MacOS';
+
plan(tests => 20);
my $Perl = which_perl();
}
# $?, $@, $$
-system qq[$PERL "-I../lib" -e "use vmsish qw(hushed); exit(0)"];
-ok $? == 0, $?;
-system qq[$PERL "-I../lib" -e "use vmsish qw(hushed); exit(1)"];
-ok $? != 0, $?;
+if ($Is_MacOS) {
+ skip('$? + system are broken on MacPerl') for 1..2;
+}
+else {
+ system qq[$PERL "-I../lib" -e "use vmsish qw(hushed); exit(0)"];
+ ok $? == 0, $?;
+ system qq[$PERL "-I../lib" -e "use vmsish qw(hushed); exit(1)"];
+ ok $? != 0, $?;
+}
eval { die "foo\n" };
ok $@ eq "foo\n", $@;
print "1..4\n";
-open(FOO,'op/read.t') || open(FOO,'t/op/read.t') || die "Can't open op.read";
+open(FOO,'op/read.t') || open(FOO,'t/op/read.t') || open(FOO,':op:read.t') || die "Can't open op.read";
seek(FOO,4,0);
$got = read(FOO,$buf,4);
@R = sort @D;
@G = sort <op/*.t>;
+@G = sort <:op:*.t> if $^O eq 'MacOS';
if ($G[0] =~ m#.*\](\w+\.t)#i) {
# grep is to convert filespecs returned from glob under VMS to format
# identical to that returned by readdir
@G = grep(s#.*\](\w+\.t).*#op/$1#i,<op/*.t>);
}
-while (@R && @G && "op/".$R[0] eq $G[0]) {
+while (@R && @G && $G[0] eq ($^O eq 'MacOS' ? ':op:' : 'op/').$R[0]) {
shift(@R);
shift(@G);
}
$Is_VMS = $^O eq 'VMS';
$Is_MSWin32 = $^O eq 'MSWin32';
$Is_NetWare = $^O eq 'NetWare';
+$Is_MacOS = $^O eq 'MacOS';
$ENV{PERL5LIB} = "../lib" unless $Is_VMS;
$|=1;
# This test checks whether Perl called srand for you.
@first_run = `$^X -le "print int rand 100 for 1..100"`;
+sleep(1); # in case our srand() is too time-dependent
@second_run = `$^X -le "print int rand 100 for 1..100"`;
ok( !eq_array(\@first_run, \@second_run), 'srand() called automatically');
$Is_Cygwin = $^O eq 'cygwin';
$Is_Darwin = $^O eq 'darwin';
$Is_Dos = $^O eq 'dos';
+$Is_MacOS = $^O eq 'MacOS';
$Is_MPE = $^O eq 'mpeix';
$Is_MSWin32 = $^O eq 'MSWin32';
$Is_NetWare = $^O eq 'NetWare';
SKIP: {
skip "-x simply determins if a file ends in an executable suffix", 1
- if $Is_Dosish;
+ if $Is_Dosish || $Is_MacOS;
ok(-x $tmpfile, ' -x');
}
# These aren't strictly "stat" calls, but so what?
-
-ok(-T 'op/stat.t', '-T');
-ok(! -B 'op/stat.t', '!-B');
+my $statfile = File::Spec->catfile($Curdir, 'op', 'stat.t');
+ok( -T $statfile, '-T');
+ok(! -B $statfile, '!-B');
SKIP: {
skip("DG/UX", 1) if $Is_DGUX;
ok(! -T $Perl, '!-T');
-open(FOO,'op/stat.t');
+open(FOO,$statfile);
SKIP: {
eval { -T FOO; };
skip "-T/B on filehandle not implemented", 15 if $@ =~ /not implemented/;
ok(! -B FOO, ' still -B');
close(FOO);
- open(FOO,'op/stat.t');
+ open(FOO,$statfile);
$_ = <FOO>;
like($_, qr/perl/, 'reopened and after readline');
ok(-T FOO, ' still -T');
unlink $tmpfile or print "# unlink failed: $!\n";
# bug id 20011101.069
-my @r = \stat(".");
+my @r = \stat($Curdir);
is(scalar @r, 13, 'stat returns full 13 elements');
SKIP: {
$* = 1; # test 3 only tested the optimized version--this one is for real
ok("ab\ncd\n" =~ /^cd/);
-if ($^O eq 'os390' or $^O eq 'posix-bc') {
+if ($^O eq 'os390' or $^O eq 'posix-bc' or $^O eq 'MacOS') {
# Even with the alarm() OS/390 and BS2000 can't manage these tests
# (Perl just goes into a busy loop, luckily an interruptable one)
for (25..26) { print "not ok $_ # TODO compiler bug?\n" }
#!./perl
$dummy = defined $&; # Now we have it...
-for $file ('op/subst.t', 't/op/subst.t') {
+for $file ('op/subst.t', 't/op/subst.t', ':op:subst.t') {
if (-r $file) {
- do "./$file";
+ do ($^O eq 'MacOS' ? $file : "./$file");
exit;
}
}
use strict;
use Config;
+use File::Spec::Functions;
my $test = 177;
sub ok ($;$) {
}
}
+my $Is_MacOS = $^O eq 'MacOS';
my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
my $Is_Cygwin = $^O eq 'cygwin';
my $Invoke_Perl = $Is_VMS ? 'MCR Sys$Disk:[]Perl.' :
($Is_MSWin32 ? '.\perl' :
+ $Is_MacOS ? ':perl' :
($Is_NetWare ? 'perl' : './perl'));
my @MoreEnv = qw/IFS CDPATH ENV BASH_ENV/;
}
# We need an external program to call.
-my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : ($Is_NetWare ? "echo$$" : "./echo$$"));
+my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : $Is_MacOS ? ":echo$$" : ($Is_NetWare ? "echo$$" : "./echo$$"));
END { unlink $ECHO }
open PROG, "> $ECHO" or die "Can't create $ECHO: $!";
print PROG 'print "@ARGV\n"', "\n";
close PROG;
my $echo = "$Invoke_Perl $ECHO";
+my $TEST = catfile(curdir(), 'TEST');
+
print "1..203\n";
# First, let's make sure that Perl is checking the dangerous
test 1, eval { `$echo 1` } eq "1\n";
- if ($Is_MSWin32 || $Is_NetWare || $Is_VMS || $Is_Dos) {
+ if ($Is_MSWin32 || $Is_NetWare || $Is_VMS || $Is_Dos || $Is_MacOS) {
print "# Environment tainting tests skipped\n";
for (2..5) { print "ok $_\n" }
}
# How about command-line arguments? The problem is that we don't
# always get some, so we'll run another process with some.
-{
- my $arg = "./arg$$";
+SKIP: {
+ my $arg = catfile(curdir(), "arg$$");
open PROG, "> $arg" or die "Can't create $arg: $!";
print PROG q{
eval { join('', @ARGV), kill 0 };
# Reading from a file should be tainted
{
- my $file = './TEST';
- test 32, open(FILE, $file), "Couldn't open '$file': $!";
+ test 32, open(FILE, $TEST), "Couldn't open '$TEST': $!";
my $block;
sysread(FILE, $block, 100);
if ($Config{d_readlink} && $Config{d_symlink}) {
my $symlink = "sl$$";
unlink($symlink);
- symlink("/something/naughty", $symlink) or die "symlink: $!\n";
+ my $sl = "/something/naughty";
+ # it has to be a real path on Mac OS
+ $sl = MacPerl::MakePath((MacPerl::Volumes())[0]) if $Is_MacOS;
+ symlink($sl, $symlink) or die "symlink: $!\n";
my $readlink = readlink($symlink);
test 144, tainted $readlink;
unlink($symlink);
{
# bug id 20001004.006
- open IN, "./TEST" or warn "$0: cannot read ./TEST: $!" ;
+ open IN, $TEST or warn "$0: cannot read $TEST: $!" ;
local $/;
my $a = <IN>;
my $b = <IN>;
{
# bug id 20001004.007
- open IN, "./TEST" or warn "$0: cannot read ./TEST: $!" ;
+ open IN, $TEST or warn "$0: cannot read $TEST: $!" ;
my $a = <IN>;
my $c = { a => 42,
# 12..47: scary format testing from Merijn H. Brand
-if ($^O eq 'VMS' || $^O eq 'MSWin32' || $^O eq 'dos' ||
+if ($^O eq 'VMS' || $^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'MacOS' ||
($^O eq 'os2' and not eval '$OS2::can_fork')) {
foreach (12..47) { print "ok $_ # skipped: '|-' and '-|' not supported\n"; }
exit(0);
$INSTDIR =~ s#/$##;
$INSTDIR =~ s#/000000/#/#;
}
-# cut 't/pod' from path (cut 't:pod:' on Mac OS)
-$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'pod');
-$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 't');
+
+$INSTDIR = (dirname $INSTDIR) if ((File::Spec->splitdir($INSTDIR))[-1] eq 'pod');
+$INSTDIR = (dirname $INSTDIR) if ((File::Spec->splitdir($INSTDIR))[-1] eq 't');
my @PODINCDIRS = ( catfile($INSTDIR, 'lib', 'Pod'),
catfile($INSTDIR, 'scripts'),
}
BEGIN {
- $numtests = ($^O eq 'VMS') ? 7 : 3;
+ # MacOS system() doesn't have good return value
+ $numtests = ($^O eq 'VMS') ? 7 : ($^O eq 'MacOS') ? 0 : 3;
}
require "test.pl";
plan(tests => $numtests);
+if ($^O ne 'MacOS') {
my $exit, $exit_arg;
$exit = run('exit');
$exit_arg = (44 & 7) if $^O eq 'VMS';
is( $exit >> 8, $exit_arg, 'Changing $? in END block' );
+}
########
eval {sub bar {print "In bar";}}
########
-system './perl -ne "print if eof" /dev/null'
+system './perl -ne "print if eof" /dev/null' unless $^O eq 'MacOS'
########
chop($file = <DATA>);
########
EXPECT
ok
########
-open(H,'run/fresh_perl.t'); # must be in the 't' directory
+open(H,$^O eq 'MacOS' ? ':run:fresh_perl.t' : 'run/fresh_perl.t'); # must be in the 't' directory
stat(H);
print "ok\n" if (-e _ and -f _ and -r _);
EXPECT
$ENV{PERL5LIB} = '../lib';
use Config;
- if ( ($Config{'cppstdin'} =~ /\bcppstdin\b/) &&
+ if ( $^O eq 'MacOS' || ($Config{'cppstdin'} =~ /\bcppstdin\b/) &&
! -x $Config{'binexp'} . "/cppstdin" ) {
print "1..0 # Skip: \$Config{cppstdin} unavailable\n";
exit; # Cannot test till after install, alas.
ok( ${^TAINT}, '${^TAINT} defined' );
-my $out = `$Perl -le "print q{Hello}"`;
+my $out = `$Perl -le "print q(Hello)"`;
is( $out, "Hello\n", '`` worked' );
like( $warning, qr/^Insecure .* $Tmsg/, ' taint warn' );
{
no warnings 'taint';
$warning = '';
- my $out = `$Perl -le "print q{Hello}"`;
+ my $out = `$Perl -le "print q(Hello)"`;
is( $out, "Hello\n", '`` worked' );
is( $warning, '', ' no warnings "taint"' );
}
}
require './test.pl';
+use File::Spec::Functions;
-print runperl( switches => ['-x'], progfile => 'run/switchx.aux' );
+print runperl( switches => ['-x'], progfile => catfile(curdir(), 'run', 'switchx.aux') );
$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;