1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateuse strict; 4*0Sstevel@tonic-gateuse warnings; 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gateBEGIN { 7*0Sstevel@tonic-gate chdir 't' if -d 't'; 8*0Sstevel@tonic-gate @INC = '../lib'; 9*0Sstevel@tonic-gate unless (find PerlIO::Layer 'perlio') { 10*0Sstevel@tonic-gate print "1..0 # Skip: not perlio\n"; 11*0Sstevel@tonic-gate exit 0; 12*0Sstevel@tonic-gate } 13*0Sstevel@tonic-gate use Config; 14*0Sstevel@tonic-gate unless (" $Config{extensions} " =~ / Fcntl /) { 15*0Sstevel@tonic-gate print "1..0 # Skip: no Fcntl (how did you get this far?)\n"; 16*0Sstevel@tonic-gate exit 0; 17*0Sstevel@tonic-gate } 18*0Sstevel@tonic-gate} 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gateuse Test::More tests => 6; 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gateuse Fcntl qw(:seek); 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gate{ 25*0Sstevel@tonic-gate ok((open my $fh, "+>", undef), "open my \$fh, '+>', undef"); 26*0Sstevel@tonic-gate print $fh "the right write stuff"; 27*0Sstevel@tonic-gate ok(seek($fh, 0, SEEK_SET), "seek to zero"); 28*0Sstevel@tonic-gate my $data = <$fh>; 29*0Sstevel@tonic-gate is($data, "the right write stuff", "found the right stuff"); 30*0Sstevel@tonic-gate} 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate{ 33*0Sstevel@tonic-gate ok((open my $fh, "+<", undef), "open my \$fh, '+<', undef"); 34*0Sstevel@tonic-gate print $fh "the right read stuff"; 35*0Sstevel@tonic-gate ok(seek($fh, 0, SEEK_SET), "seek to zero"); 36*0Sstevel@tonic-gate my $data = <$fh>; 37*0Sstevel@tonic-gate is($data, "the right read stuff", "found the right stuff"); 38*0Sstevel@tonic-gate} 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate 43