diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1999-05-07 21:24:50 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1999-05-07 21:24:50 +0000 |
commit | 853846ea710f8feaed8c98b358bdc8967dd522d2 (patch) | |
tree | b897c99fba920636ba7e2d962c8cf67880fd40d6 /t/io | |
parent | 7c1e0849686a4ea069f6fa2a095a70c337e62ace (diff) | |
download | perl-853846ea710f8feaed8c98b358bdc8967dd522d2.tar.gz |
Implement open( my $fh, ...) and similar.
Set flag in op.c for "constructor ops"
In pp_rv2gv, if flag is set and arg is PADSV and uninit
vivify as reference to a detached GV.
(Name of GV is the pad name.)
This scheme should "just work" for pipe/socket etc. too.
#if 0 out the open(FH,undef) for now.
Change t/io/open.t to test open(my $fh,...)
p4raw-id: //depot/perl@3326
Diffstat (limited to 't/io')
-rwxr-xr-x | t/io/open.t | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/t/io/open.t b/t/io/open.t index 819393f29b..0203f34539 100755 --- a/t/io/open.t +++ b/t/io/open.t @@ -1,22 +1,34 @@ #!./perl # $RCSfile$ -$| = 1; +$| = 1; +$^W = 1; -print "1..6\n"; +print "1..8\n"; -print "$!\nnot " unless open(A,undef); +# my $file tests + +unlink("afile.new") if -f "afile"; +print "$!\nnot " unless open(my $f,"+>afile"); print "ok 1\n"; -print "not " unless print A "SomeData\n"; +print "not " unless -f "afile"; print "ok 2\n"; -print "not " unless tell(A) == 9; +print "not " unless print $f "SomeData\n"; print "ok 3\n"; -print "not " unless seek(A,0,0); +print "not " unless tell($f) == 9; print "ok 4\n"; -$b = <A>; -print "not " unless $b eq "SomeData\n"; +print "not " unless seek($f,0,0); print "ok 5\n"; -print "not " unless close(A); +$b = <$f>; +print "not " unless $b eq "SomeData\n"; print "ok 6\n"; - +print "not " unless -f $f; +print "ok 7\n"; +eval { die "Message" }; +# warn $@; +print "not " unless $@ =~ /<\$f> line 1/; +print "ok 8\n"; +print "not " unless close($f); +print "ok 9\n"; +unlink("afile"); |