summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-06-18 08:04:44 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-06-18 08:04:44 +0000
commit370a0481ecee92d75bbc6f38ccbbfa820fff9abb (patch)
tree65f420936ba9781c1ba7a184c8d8cc5b1b98aadd /t/op
parent2f8118af5e6ae8b76fdc332011717931c71acde6 (diff)
parentb695f709e8a342e35e482b0437eb6cdacdc58b6b (diff)
downloadperl-370a0481ecee92d75bbc6f38ccbbfa820fff9abb.tar.gz
Integrate mainline (part1)
p4raw-id: //depot/perlio@10677
Diffstat (limited to 't/op')
-rwxr-xr-xt/op/anonsub.t5
-rwxr-xr-xt/op/closure.t5
-rwxr-xr-xt/op/die_exit.t2
-rwxr-xr-xt/op/exec.t2
-rwxr-xr-xt/op/fork.t9
-rwxr-xr-xt/op/goto.t2
-rwxr-xr-xt/op/groups.t2
-rw-r--r--t/op/lfs.t2
-rwxr-xr-xt/op/magic.t7
-rwxr-xr-xt/op/misc.t7
-rwxr-xr-xt/op/rand.t1
-rwxr-xr-xt/op/runlevel.t3
-rwxr-xr-xt/op/split.t1
-rwxr-xr-xt/op/stat.t21
-rwxr-xr-xt/op/sub_lval.t533
-rwxr-xr-xt/op/sysio.t2
-rwxr-xr-xt/op/taint.t10
-rwxr-xr-xt/op/write.t5
18 files changed, 586 insertions, 33 deletions
diff --git a/t/op/anonsub.t b/t/op/anonsub.t
index aa25de0131..0e4c40494f 100755
--- a/t/op/anonsub.t
+++ b/t/op/anonsub.t
@@ -5,6 +5,7 @@ chdir 't' if -d 't';
$Is_VMS = $^O eq 'VMS';
$Is_MSWin32 = $^O eq 'MSWin32';
$Is_MacOS = $^O eq 'MacOS';
+$Is_NetWare = $^O eq 'NetWare';
$ENV{PERL5LIB} = "../lib" unless $Is_VMS;
$|=1;
@@ -32,7 +33,9 @@ for (@prgs){
`.\\perl -I../lib $switch $tmpfile 2>&1` :
$Is_MacOS ?
`$^X -I::lib $switch $tmpfile` :
- `./perl $switch $tmpfile 2>&1`;
+ $Is_NetWare ?
+ `perl -I../lib $switch $tmpfile 2>&1` :
+ `./perl $switch $tmpfile 2>&1`;
my $status = $?;
$results =~ s/\n+$//;
# allow expected output to be written as if $prog is on STDIN
diff --git a/t/op/closure.t b/t/op/closure.t
index 633428607e..159392c93b 100755
--- a/t/op/closure.t
+++ b/t/op/closure.t
@@ -429,7 +429,7 @@ END
$test++;
}
- if ($Config{d_fork} and $^O ne 'VMS' and $^O ne 'MSWin32') {
+ if ($Config{d_fork} and $^O ne 'VMS' and $^O ne 'MSWin32' and $^O ne 'NetWare') {
# Fork off a new perl to run the tests.
# (This is so we can catch spurious warnings.)
$| = 1; print ""; $| = 0; # flush output before forking
@@ -466,9 +466,10 @@ END
my $cmd = (($^O eq 'VMS') ? "MCR $^X"
: ($^O eq 'MSWin32') ? '.\perl'
: ($^O eq 'MacOS') ? $^X
+ : ($^O eq 'NetWare') ? 'perl'
: './perl');
$cmd .= " -w $cmdfile 2>$errfile";
- if ($^O eq 'VMS' or $^O eq 'MSWin32') {
+ if ($^O eq 'VMS' or $^O eq 'MSWin32' or $^O eq 'NetWare') {
# Use pipe instead of system so we don't inherit STD* from
# this process, and then foul our pipe back to parent by
# redirecting output in the child.
diff --git a/t/op/die_exit.t b/t/op/die_exit.t
index f758f9c237..18d8babfdc 100755
--- a/t/op/die_exit.t
+++ b/t/op/die_exit.t
@@ -50,7 +50,7 @@ foreach my $test (1 .. $max) {
my($bang, $query, $code) = @{$tests{$test}};
$code ||= 'die;';
my $exit =
- ($^O eq 'MSWin32'
+ (($^O eq 'MSWin32' || $^O eq 'NetWare')
? system qq($perl -e "\$! = $bang; \$? = $query; $code" 2> nul)
: system qq($perl -e '\$! = $bang; \$? = $query; $code' 2> /dev/null));
diff --git a/t/op/exec.t b/t/op/exec.t
index 57a114e766..2defb47db4 100755
--- a/t/op/exec.t
+++ b/t/op/exec.t
@@ -5,7 +5,7 @@ $| = 1; # flush stdout
$ENV{LC_ALL} = 'C'; # Forge English error messages.
$ENV{LANGUAGE} = 'C'; # Ditto in GNU.
-if ($^O eq 'MSWin32') {
+if ($^O eq 'MSWin32' || $^O eq 'NetWare') {
# XXX the system tests could be written to use ./perl and so work on Win32
print "1..0 # Skip: shh, win32\n";
exit(0);
diff --git a/t/op/fork.t b/t/op/fork.t
index fbcd0987fe..b3faa19aa7 100755
--- a/t/op/fork.t
+++ b/t/op/fork.t
@@ -7,7 +7,7 @@ BEGIN {
@INC = '../lib';
require Config; import Config;
unless ($Config{'d_fork'}
- or ($^O eq 'MSWin32' and $Config{useithreads}
+ or (($^O eq 'MSWin32' || $^O eq 'NetWare') and $Config{useithreads}
and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/
# and !defined $Config{'useperlio'}
))
@@ -33,7 +33,7 @@ $tmpfile = "forktmp000";
1 while -f ++$tmpfile;
END { close TEST; unlink $tmpfile if $tmpfile; }
-$CAT = (($^O eq 'MSWin32') ? '.\perl -e "print <>"' : 'cat');
+$CAT = (($^O eq 'MSWin32') ? '.\perl -e "print <>"' : (($^O eq 'NetWare') ? 'perl -e "print <>"' : 'cat'));
for (@prgs){
my $switch;
@@ -51,6 +51,9 @@ for (@prgs){
if ($^O eq 'MSWin32') {
$results = `.\\perl -I../lib $switch $tmpfile 2>&1`;
}
+ elsif ($^O eq 'NetWare') {
+ $results = `perl -I../lib $switch $tmpfile 2>&1`;
+ }
else {
$results = `./perl $switch $tmpfile 2>&1`;
}
@@ -255,7 +258,7 @@ ok 1 child
$| = 1;
$\ = "\n";
my $getenv;
-if ($^O eq 'MSWin32') {
+if ($^O eq 'MSWin32' || $^O eq 'NetWare') {
$getenv = qq[$^X -e "print \$ENV{TST}"];
}
else {
diff --git a/t/op/goto.t b/t/op/goto.t
index 579e8180e4..a0b4d55e74 100755
--- a/t/op/goto.t
+++ b/t/op/goto.t
@@ -29,7 +29,7 @@ label4:
print "#2\t:$foo: == 4\n";
if ($foo == 4) {print "ok 2\n";} else {print "not ok 2\n";}
-$PERL = ($^O eq 'MSWin32') ? '.\perl' : ($^O eq 'MacOS') ? $^X : './perl';
+$PERL = ($^O eq 'MSWin32') ? '.\perl' : ($^O eq 'MacOS') ? $^X : ($^O eq 'NetWare') ? 'perl' : './perl';
$CMD = qq[$PERL -e "goto foo;" 2>&1 ];
$x = `$CMD`;
diff --git a/t/op/groups.t b/t/op/groups.t
index 082d2d1d9f..0531826dba 100755
--- a/t/op/groups.t
+++ b/t/op/groups.t
@@ -10,7 +10,7 @@ sub quit {
exit 0;
}
-quit() if $^O eq 'MSWin32' or $^O =~ /lynxos/i;
+quit() if (($^O eq 'MSWin32' || $^O eq 'NetWare') or $^O =~ /lynxos/i);
# We have to find a command that prints all (effective
# and real) group names (not ids). The known commands are:
diff --git a/t/op/lfs.t b/t/op/lfs.t
index 44a92c4855..2652555281 100644
--- a/t/op/lfs.t
+++ b/t/op/lfs.t
@@ -59,7 +59,7 @@ $| = 1;
print "# checking whether we have sparse files...\n";
# Known have-nots.
-if ($^O eq 'MSWin32' || $^O eq 'VMS') {
+if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
print "1..0 # Skip: no sparse files in $^O\n";
bye();
}
diff --git a/t/op/magic.t b/t/op/magic.t
index c8b2d1c7bf..935e574990 100755
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -21,11 +21,12 @@ sub ok {
}
$Is_MSWin32 = $^O eq 'MSWin32';
+$Is_NetWare = $^O eq 'NetWare';
$Is_VMS = $^O eq 'VMS';
$Is_Dos = $^O eq 'dos';
$Is_os2 = $^O eq 'os2';
$Is_Cygwin = $^O eq 'cygwin';
-$PERL = ($Is_MSWin32 ? '.\perl' : './perl');
+$PERL = ($Is_MSWin32 ? '.\perl' : ($Is_NetWare ? 'perl' : './perl'));
print "1..41\n";
@@ -39,7 +40,7 @@ open(FOO,'ajslkdfpqjsjfk');
ok 2, $!, $!;
close FOO; # just mention it, squelch used-only-once
-if ($Is_MSWin32 || $Is_Dos) {
+if ($Is_MSWin32 || $Is_NetWare || $Is_Dos) {
ok "3 # skipped",1;
ok "4 # skipped",1;
}
@@ -211,7 +212,7 @@ else {
# test case-insignificance of %ENV (these tests must be enabled only
# when perl is compiled with -DENV_IS_CASELESS)
-if ($Is_MSWin32) {
+if ($Is_MSWin32 || $Is_NetWare) {
%ENV = ();
$ENV{'Foo'} = 'bar';
$ENV{'fOo'} = 'baz';
diff --git a/t/op/misc.t b/t/op/misc.t
index 679dd91d0d..b00f4b1b74 100755
--- a/t/op/misc.t
+++ b/t/op/misc.t
@@ -17,7 +17,7 @@ $tmpfile = "misctmp000";
1 while -f ++$tmpfile;
END { while($tmpfile && unlink $tmpfile){} }
-$CAT = (($^O eq 'MSWin32') ? '.\perl -e "print <>"' : 'cat');
+$CAT = (($^O eq 'MSWin32') ? '.\perl -e "print <>"' : (($^O eq 'NetWare') ? 'perl -e "print <>"' : 'cat'));
for (@prgs){
my $switch;
@@ -35,6 +35,9 @@ for (@prgs){
if ($^O eq 'MSWin32') {
$results = `.\\perl -I../lib $switch $tmpfile 2>&1`;
}
+ elsif ($^O eq 'NetWare') {
+ $results = `perl -I../lib $switch $tmpfile 2>&1`;
+ }
else {
$results = `./perl $switch $tmpfile 2>&1`;
}
@@ -624,7 +627,7 @@ my $have_setlocale = $Config{d_setlocale} eq 'define';
$have_setlocale = 0 if $@;
# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
# and mingw32 uses said silly CRT
-$have_setlocale = 0 if $^O eq 'MSWin32' && $Config{cc} =~ /^(cl|gcc)/i;
+$have_setlocale = 0 if (($^O eq 'MSWin32' || $^O eq 'NetWare') && $Config{cc} =~ /^(cl|gcc)/i);
exit(0) unless $have_setlocale;
my @locales;
if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a|")) {
diff --git a/t/op/rand.t b/t/op/rand.t
index 83186aeb66..e365e597b4 100755
--- a/t/op/rand.t
+++ b/t/op/rand.t
@@ -342,6 +342,7 @@ AUTOSRAND:
for (1..5) {
my $PERL = (($^O eq 'VMS') ? "MCR $^X"
: ($^O eq 'MSWin32') ? '.\perl'
+ : ($^O eq 'NetWare') ? 'perl'
: './perl');
$pid = open PERL, qq[$PERL -e "print rand"|];
die "Couldn't pipe from perl: $!" unless defined $pid;
diff --git a/t/op/runlevel.t b/t/op/runlevel.t
index 3140f02103..136480129b 100755
--- a/t/op/runlevel.t
+++ b/t/op/runlevel.t
@@ -10,6 +10,7 @@ chdir 't' if -d 't';
@INC = '../lib';
$Is_VMS = $^O eq 'VMS';
$Is_MSWin32 = $^O eq 'MSWin32';
+$Is_NetWare = $^O eq 'NetWare';
$ENV{PERL5LIB} = "../lib" unless $Is_VMS;
$|=1;
@@ -35,6 +36,8 @@ for (@prgs){
`MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
$Is_MSWin32 ?
`.\\perl -I../lib $switch $tmpfile 2>&1` :
+ $Is_NetWare ?
+ `perl -I../lib $switch $tmpfile 2>&1` :
`./perl $switch $tmpfile 2>&1`;
my $status = $?;
$results =~ s/\n+$//;
diff --git a/t/op/split.t b/t/op/split.t
index 4e3e546c18..8aa91e506f 100755
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -51,6 +51,7 @@ print $_ eq '1:2:3:4:5:6:::' ? "ok 10\n" : "not ok 10 $_\n";
# Does assignment to a list imply split to one more field than that?
if ($^O eq 'MSWin32') { $foo = `.\\perl -D1024 -e "(\$a,\$b) = split;" 2>&1` }
+elsif ($^O eq 'NetWare') { $foo = `perl -D1024 -e "(\$a,\$b) = split;" 2>&1` }
elsif ($^O eq 'VMS') { $foo = `./perl "-D1024" -e "(\$a,\$b) = split;" 2>&1` }
elsif ($^O eq 'MacOS'){ $foo = `$^X "-D1024" -e "(\$a,\$b) = split;"` }
else { $foo = `./perl -D1024 -e '(\$a,\$b) = split;' 2>&1` }
diff --git a/t/op/stat.t b/t/op/stat.t
index f7a2a4ec8d..f3cf2efbd6 100755
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -12,17 +12,18 @@ use Config;
print "1..58\n";
$Is_MSWin32 = $^O eq 'MSWin32';
+$Is_NetWare = $^O eq 'NetWare';
$Is_Dos = $^O eq 'dos';
-$Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32;
+$Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32 || $Is_NetWare;
$Is_Cygwin = $^O eq 'cygwin';
-chop($cwd = ($Is_MSWin32 ? `cd` : `pwd`));
+chop($cwd = (($Is_MSWin32 || $Is_NetWare) ? `cd` : `pwd`));
$DEV = `ls -l /dev` unless $Is_Dosish or $Is_Cygwin;
unlink "Op.stat.tmp";
if (open(FOO, ">Op.stat.tmp")) {
# hack to make Apollo update link count:
- $junk = `ls Op.stat.tmp` unless ($Is_MSWin32 || $Is_Dos);
+ $junk = `ls Op.stat.tmp` unless ($Is_MSWin32 || $Is_NetWare || $Is_Dos);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat(FOO);
@@ -32,7 +33,7 @@ if (open(FOO, ">Op.stat.tmp")) {
else {
print "# res=$res, nlink=$nlink.\nnot ok 1\n";
}
- if ($Is_MSWin32 or $Is_Cygwin or $Is_Dos || ($mtime && $mtime == $ctime)) {
+ if ($Is_MSWin32 or $Is_NetWare or $Is_Cygwin or $Is_Dos || ($mtime && $mtime == $ctime)) {
print "ok 2\n";
}
else {
@@ -85,7 +86,7 @@ else {
print "#4 :$mtime: should != :$ctime:\n";
unlink "Op.stat.tmp" or print "# unlink failed: $!\n";
-if ($Is_MSWin32) { open F, '>Op.stat.tmp' and close F }
+if ($Is_MSWin32 || $Is_NetWare) { open F, '>Op.stat.tmp' and close F }
else { `touch Op.stat.tmp` }
if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
@@ -141,7 +142,7 @@ if (-e 'Op.stat.tmp') {print "ok 27\n";} else {print "not ok 27\n";}
unlink 'Op.stat.tmp2';
if (! -e 'Op.stat.tmp2') {print "ok 28\n";} else {print "not ok 28\n";}
-if ($Is_MSWin32 || $Is_Dos)
+if ($Is_MSWin32 || $Is_NetWare || $Is_Dos)
{print "ok 29\n";}
elsif ($DEV !~ /\nc.* (\S+)\n/)
{print "ok 29\n";}
@@ -151,7 +152,7 @@ else
{print "not ok 29\n";}
if (! -c '.') {print "ok 30\n";} else {print "not ok 30\n";}
-if ($Is_MSWin32 || $Is_Dos)
+if ($Is_MSWin32 || $Is_NetWare || $Is_Dos)
{print "ok 31\n";}
elsif ($DEV !~ /\ns.* (\S+)\n/)
{print "ok 31\n";}
@@ -161,7 +162,7 @@ else
{print "not ok 31\n";}
if (! -S '.') {print "ok 32\n";} else {print "not ok 32\n";}
-if ($Is_MSWin32 || $Is_Dos)
+if ($Is_MSWin32 || $Is_NetWare || $Is_Dos)
{print "ok 33\n";}
elsif ($DEV !~ /\nb.* (\S+)\n/)
{print "ok 33\n";}
@@ -205,7 +206,7 @@ tty_test:
# may not be available (at, cron rsh etc), the PERL_SKIP_TTY_TEST env var
# can be set to skip the tests that need a tty.
unless($ENV{PERL_SKIP_TTY_TEST}) {
- if ($Is_MSWin32) {
+ if ($Is_MSWin32 || $Is_NetWare) {
print "ok 36\n";
print "ok 37\n";
}
@@ -236,7 +237,7 @@ else {
print "ok 39\n";
}
open(null,"/dev/null");
-if (! -t null || -e '/xenix' || $^O eq 'machten' || $Is_MSWin32)
+if (! -t null || -e '/xenix' || $^O eq 'machten' || $Is_MSWin32 || $Is_NetWare)
{print "ok 40\n";} else {print "not ok 40\n";}
close(null);
diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t
new file mode 100755
index 0000000000..e101f97cf6
--- /dev/null
+++ b/t/op/sub_lval.t
@@ -0,0 +1,533 @@
+print "1..64\n";
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
+sub b : lvalue { ${\shift} }
+
+my $out = a(b()); # Check that temporaries are allowed.
+print "# `$out'\nnot " unless ref $out eq 'main'; # Not reached if error.
+print "ok 1\n";
+
+my @out = grep /main/, a(b()); # Check that temporaries are allowed.
+print "# `@out'\nnot " unless @out==1; # Not reached if error.
+print "ok 2\n";
+
+my $in;
+
+# Check that we can return localized values from subroutines:
+
+sub in : lvalue { $in = shift; }
+sub neg : lvalue { #(num_str) return num_str
+ local $_ = shift;
+ s/^\+/-/;
+ $_;
+}
+in(neg("+2"));
+
+
+print "# `$in'\nnot " unless $in eq '-2';
+print "ok 3\n";
+
+sub get_lex : lvalue { $in }
+sub get_st : lvalue { $blah }
+sub id : lvalue { ${\shift} }
+sub id1 : lvalue { $_[0] }
+sub inc : lvalue { ${\++$_[0]} }
+
+$in = 5;
+$blah = 3;
+
+get_st = 7;
+
+print "# `$blah' ne 7\nnot " unless $blah eq 7;
+print "ok 4\n";
+
+get_lex = 7;
+
+print "# `$in' ne 7\nnot " unless $in eq 7;
+print "ok 5\n";
+
+++get_st;
+
+print "# `$blah' ne 8\nnot " unless $blah eq 8;
+print "ok 6\n";
+
+++get_lex;
+
+print "# `$in' ne 8\nnot " unless $in eq 8;
+print "ok 7\n";
+
+id(get_st) = 10;
+
+print "# `$blah' ne 10\nnot " unless $blah eq 10;
+print "ok 8\n";
+
+id(get_lex) = 10;
+
+print "# `$in' ne 10\nnot " unless $in eq 10;
+print "ok 9\n";
+
+++id(get_st);
+
+print "# `$blah' ne 11\nnot " unless $blah eq 11;
+print "ok 10\n";
+
+++id(get_lex);
+
+print "# `$in' ne 11\nnot " unless $in eq 11;
+print "ok 11\n";
+
+id1(get_st) = 20;
+
+print "# `$blah' ne 20\nnot " unless $blah eq 20;
+print "ok 12\n";
+
+id1(get_lex) = 20;
+
+print "# `$in' ne 20\nnot " unless $in eq 20;
+print "ok 13\n";
+
+++id1(get_st);
+
+print "# `$blah' ne 21\nnot " unless $blah eq 21;
+print "ok 14\n";
+
+++id1(get_lex);
+
+print "# `$in' ne 21\nnot " unless $in eq 21;
+print "ok 15\n";
+
+inc(get_st);
+
+print "# `$blah' ne 22\nnot " unless $blah eq 22;
+print "ok 16\n";
+
+inc(get_lex);
+
+print "# `$in' ne 22\nnot " unless $in eq 22;
+print "ok 17\n";
+
+inc(id(get_st));
+
+print "# `$blah' ne 23\nnot " unless $blah eq 23;
+print "ok 18\n";
+
+inc(id(get_lex));
+
+print "# `$in' ne 23\nnot " unless $in eq 23;
+print "ok 19\n";
+
+++inc(id1(id(get_st)));
+
+print "# `$blah' ne 25\nnot " unless $blah eq 25;
+print "ok 20\n";
+
+++inc(id1(id(get_lex)));
+
+print "# `$in' ne 25\nnot " unless $in eq 25;
+print "ok 21\n";
+
+@a = (1) x 3;
+@b = (undef) x 2;
+$#c = 3; # These slots are not fillable.
+
+# Explanation: empty slots contain &sv_undef.
+
+=for disabled constructs
+
+sub a3 :lvalue {@a}
+sub b2 : lvalue {@b}
+sub c4: lvalue {@c}
+
+$_ = '';
+
+eval <<'EOE' or $_ = $@;
+ ($x, a3, $y, b2, $z, c4, $t) = (34 .. 78);
+ 1;
+EOE
+
+#@out = ($x, a3, $y, b2, $z, c4, $t);
+#@in = (34 .. 41, (undef) x 4, 46);
+#print "# `@out' ne `@in'\nnot " unless "@out" eq "@in";
+
+print "# '$_'.\nnot "
+ unless /Can\'t return an uninitialized value from lvalue subroutine/;
+=cut
+
+print "ok 22\n";
+
+my $var;
+
+sub a::var : lvalue { $var }
+
+"a"->var = 45;
+
+print "# `$var' ne 45\nnot " unless $var eq 45;
+print "ok 23\n";
+
+my $oo;
+$o = bless \$oo, "a";
+
+$o->var = 47;
+
+print "# `$var' ne 47\nnot " unless $var eq 47;
+print "ok 24\n";
+
+sub o : lvalue { $o }
+
+o->var = 49;
+
+print "# `$var' ne 49\nnot " unless $var eq 49;
+print "ok 25\n";
+
+sub nolv () { $x0, $x1 } # Not lvalue
+
+$_ = '';
+
+eval <<'EOE' or $_ = $@;
+ nolv = (2,3);
+ 1;
+EOE
+
+print "not "
+ unless /Can\'t modify non-lvalue subroutine call in scalar assignment/;
+print "ok 26\n";
+
+$_ = '';
+
+eval <<'EOE' or $_ = $@;
+ nolv = (2,3) if $_;
+ 1;
+EOE
+
+print "not "
+ unless /Can\'t modify non-lvalue subroutine call in scalar assignment/;
+print "ok 27\n";
+
+$_ = '';
+
+eval <<'EOE' or $_ = $@;
+ &nolv = (2,3) if $_;
+ 1;
+EOE
+
+print "not "
+ unless /Can\'t modify non-lvalue subroutine call in scalar assignment/;
+print "ok 28\n";
+
+$x0 = $x1 = $_ = undef;
+$nolv = \&nolv;
+
+eval <<'EOE' or $_ = $@;
+ $nolv->() = (2,3) if $_;
+ 1;
+EOE
+
+print "# '$_', '$x0', '$x1'.\nnot " if defined $_;
+print "ok 29\n";
+
+$x0 = $x1 = $_ = undef;
+$nolv = \&nolv;
+
+eval <<'EOE' or $_ = $@;
+ $nolv->() = (2,3);
+ 1;
+EOE
+
+print "# '$_', '$x0', '$x1'.\nnot "
+ unless /Can\'t modify non-lvalue subroutine call/;
+print "ok 30\n";
+
+sub lv0 : lvalue { } # Converted to lv10 in scalar context
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ lv0 = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t return a readonly value from lvalue subroutine/;
+print "ok 31\n";
+
+sub lv10 : lvalue {}
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ (lv0) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot " if defined $_;
+print "ok 32\n";
+
+sub lv1u :lvalue { undef }
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ lv1u = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t return a readonly value from lvalue subroutine/;
+print "ok 33\n";
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ (lv1u) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t return an uninitialized value from lvalue subroutine/;
+print "ok 34\n";
+
+$x = '1234567';
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ sub lv1t : lvalue { index $x, 2 }
+ lv1t = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t modify index in lvalue subroutine return/;
+print "ok 35\n";
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ sub lv2t : lvalue { shift }
+ (lv2t) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t modify shift in lvalue subroutine return/;
+print "ok 36\n";
+
+$xxx = 'xxx';
+sub xxx () { $xxx } # Not lvalue
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ sub lv1tmp : lvalue { xxx } # is it a TEMP?
+ lv1tmp = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t modify non-lvalue subroutine call in lvalue subroutine return/;
+print "ok 37\n";
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ (lv1tmp) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t return a temporary from lvalue subroutine/;
+print "ok 38\n";
+
+sub yyy () { 'yyy' } # Const, not lvalue
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ sub lv1tmpr : lvalue { yyy } # is it read-only?
+ lv1tmpr = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t modify constant item in lvalue subroutine return/;
+print "ok 39\n";
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ (lv1tmpr) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot "
+ unless /Can\'t return a readonly value from lvalue subroutine/;
+print "ok 40\n";
+
+sub lva : lvalue {@a}
+
+$_ = undef;
+@a = ();
+$a[1] = 12;
+eval <<'EOE' or $_ = $@;
+ (lva) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot " unless "'@a' $_" eq "'2 3' ";
+print "ok 41\n";
+
+$_ = undef;
+@a = ();
+$a[0] = undef;
+$a[1] = 12;
+eval <<'EOE' or $_ = $@;
+ (lva) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot " unless "'@a' $_" eq "'2 3' ";
+print "ok 42\n";
+
+$_ = undef;
+@a = ();
+$a[0] = undef;
+$a[1] = 12;
+eval <<'EOE' or $_ = $@;
+ (lva) = (2,3);
+ 1;
+EOE
+
+print "# '$_'.\nnot " unless "'@a' $_" eq "'2 3' ";
+print "ok 43\n";
+
+sub lv1n : lvalue { $newvar }
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ lv1n = (3,4);
+ 1;
+EOE
+
+print "# '$_', '$newvar'.\nnot " unless "'$newvar' $_" eq "'4' ";
+print "ok 44\n";
+
+sub lv1nn : lvalue { $nnewvar }
+
+$_ = undef;
+eval <<'EOE' or $_ = $@;
+ (lv1nn) = (3,4);
+ 1;
+EOE
+
+print "# '$_'.\nnot " unless "'$nnewvar' $_" eq "'3' ";
+print "ok 45\n";
+
+$a = \&lv1nn;
+$a->() = 8;
+print "# '$nnewvar'.\nnot " unless $nnewvar eq '8';
+print "ok 46\n";
+
+# This must happen at run time
+eval {
+ sub AUTOLOAD : lvalue { $newvar };
+};
+foobar() = 12;
+print "# '$newvar'.\nnot " unless $newvar eq "12";
+print "ok 47\n";
+
+print "ok 48 # Skip: removed test\n";
+
+print "ok 49 # Skip: removed test\n";
+
+{
+my %hash; my @array;
+sub alv : lvalue { $array[1] }
+sub alv2 : lvalue { $array[$_[0]] }
+sub hlv : lvalue { $hash{"foo"} }
+sub hlv2 : lvalue { $hash{$_[0]} }
+$array[1] = "not ok 51\n";
+alv() = "ok 50\n";
+print alv();
+
+alv2(20) = "ok 51\n";
+print $array[20];
+
+$hash{"foo"} = "not ok 52\n";
+hlv() = "ok 52\n";
+print $hash{foo};
+
+$hash{bar} = "not ok 53\n";
+hlv("bar") = "ok 53\n";
+print hlv("bar");
+
+sub array : lvalue { @array }
+sub array2 : lvalue { @array2 } # This is a global.
+sub hash : lvalue { %hash }
+sub hash2 : lvalue { %hash2 } # So's this.
+@array2 = qw(foo bar);
+%hash2 = qw(foo bar);
+
+(array()) = qw(ok 54);
+print "not " unless "@array" eq "ok 54";
+print "ok 54\n";
+
+(array2()) = qw(ok 55);
+print "not " unless "@array2" eq "ok 55";
+print "ok 55\n";
+
+(hash()) = qw(ok 56);
+print "not " unless $hash{ok} == 56;
+print "ok 56\n";
+
+(hash2()) = qw(ok 57);
+print "not " unless $hash2{ok} == 57;
+print "ok 57\n";
+
+@array = qw(a b c d);
+sub aslice1 : lvalue { @array[0,2] };
+(aslice1()) = ("ok", "already");
+print "# @array\nnot " unless "@array" eq "ok b already d";
+print "ok 58\n";
+
+@array2 = qw(a B c d);
+sub aslice2 : lvalue { @array2[0,2] };
+(aslice2()) = ("ok", "already");
+print "not " unless "@array2" eq "ok B already d";
+print "ok 59\n";
+
+%hash = qw(a Alpha b Beta c Gamma);
+sub hslice : lvalue { @hash{"c", "b"} }
+(hslice()) = ("CISC", "BogoMIPS");
+print "not " unless join("/",@hash{"c","a","b"}) eq "CISC/Alpha/BogoMIPS";
+print "ok 60\n";
+}
+
+$str = "Hello, world!";
+sub sstr : lvalue { substr($str, 1, 4) }
+sstr() = "i";
+print "not " unless $str eq "Hi, world!";
+print "ok 61\n";
+
+$str = "Made w/ JavaScript";
+sub veclv : lvalue { vec($str, 2, 32) }
+if (ord('A') != 193) {
+ veclv() = 0x5065726C;
+}
+else { # EBCDIC?
+ veclv() = 0xD7859993;
+}
+print "# $str\nnot " unless $str eq "Made w/ PerlScript";
+print "ok 62\n";
+
+sub position : lvalue { pos }
+@p = ();
+$_ = "fee fi fo fum";
+while (/f/g) {
+ push @p, position;
+ position() += 6;
+}
+print "# @p\nnot " unless "@p" eq "1 8";
+print "ok 63\n";
+
+# Bug 20001223.002: split thought that the list had only one element
+@ary = qw(4 5 6);
+sub lval1 : lvalue { $ary[0]; }
+sub lval2 : lvalue { $ary[1]; }
+(lval1(), lval2()) = split ' ', "1 2 3 4";
+print "not " unless join(':', @ary) eq "1:2:6";
+print "ok 64\n";
diff --git a/t/op/sysio.t b/t/op/sysio.t
index e43f850154..251c7f8151 100755
--- a/t/op/sysio.t
+++ b/t/op/sysio.t
@@ -6,7 +6,7 @@ chdir('op') || chdir('t/op') || die "sysio.t: cannot look for myself: $!";
open(I, 'sysio.t') || die "sysio.t: cannot find myself: $!";
-$reopen = ($^O eq 'VMS' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'dos' ||
+$reopen = ($^O eq 'VMS' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'dos' ||
$^O eq 'mpeix');
$x = 'abc';
diff --git a/t/op/taint.t b/t/op/taint.t
index 0d1e747daf..c2bb2f8705 100755
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -40,9 +40,11 @@ BEGIN {
my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
+my $Is_NetWare = $^O eq 'NetWare';
my $Is_Dos = $^O eq 'dos';
my $Invoke_Perl = $Is_VMS ? 'MCR Sys$Disk:[]Perl.' :
- $Is_MSWin32 ? '.\perl' : './perl';
+ ($Is_MSWin32 ? '.\perl' :
+ ($Is_NetWare ? 'perl' : './perl'));
my @MoreEnv = qw/IFS CDPATH ENV BASH_ENV/;
if ($Is_VMS) {
@@ -99,7 +101,7 @@ sub test ($$;$) {
}
# We need an external program to call.
-my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : "./echo$$");
+my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : ($Is_NetWare ? "echo$$" : "./echo$$"));
END { unlink $ECHO }
open PROG, "> $ECHO" or die "Can't create $ECHO: $!";
print PROG 'print "@ARGV\n"', "\n";
@@ -120,7 +122,7 @@ print "1..174\n";
test 1, eval { `$echo 1` } eq "1\n";
- if ($Is_MSWin32 || $Is_VMS || $Is_Dos) {
+ if ($Is_MSWin32 || $Is_NetWare || $Is_VMS || $Is_Dos) {
print "# Environment tainting tests skipped\n";
for (2..5) { print "ok $_\n" }
}
@@ -144,7 +146,7 @@ print "1..174\n";
}
my $tmp;
- if ($^O eq 'os2' || $^O eq 'amigaos' || $Is_MSWin32 || $Is_Dos) {
+ if ($^O eq 'os2' || $^O eq 'amigaos' || $Is_MSWin32 || $Is_NetWare || $Is_Dos) {
print "# all directories are writeable\n";
}
else {
diff --git a/t/op/write.t b/t/op/write.t
index 8e4cca8fdc..28309748d1 100755
--- a/t/op/write.t
+++ b/t/op/write.t
@@ -7,8 +7,9 @@ BEGIN {
print "1..44\n";
-my $CAT = ($^O eq 'MSWin32') ? 'type'
- : ($^O eq 'MacOS') ? 'catenate' : 'cat';
+my $CAT = ($^O eq 'MSWin32' || $^O eq 'NetWare') ? 'type'
+ : ($^O eq 'MacOS') ? 'catenate'
+ : 'cat';
format OUT =
the quick brown @<<