1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 require './test.pl'; 6 set_up_inc('../lib'); 7 skip_all_without_perlio(); 8 skip_all_without_dynamic_extension('Fcntl'); # how did you get this far? 9} 10 11use strict; 12use warnings; 13 14plan tests => 6; 15 16use Fcntl qw(:seek); 17 18{ 19 ok((open my $fh, "+>", undef), "open my \$fh, '+>', undef"); 20 print $fh "the right write stuff"; 21 ok(seek($fh, 0, SEEK_SET), "seek to zero"); 22 my $data = <$fh>; 23 is($data, "the right write stuff", "found the right stuff"); 24} 25 26{ 27 ok((open my $fh, "+<", undef), "open my \$fh, '+<', undef"); 28 print $fh "the right read stuff"; 29 ok(seek($fh, 0, SEEK_SET), "seek to zero"); 30 my $data = <$fh>; 31 is($data, "the right read stuff", "found the right stuff"); 32} 33 34 35 36 37