1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = '../lib'; 6} 7 8use Tie::StdHandle; 9tie *tst,Tie::StdHandle; 10 11$f = 'tst'; 12 13print "1..13\n"; 14 15# my $file tests 16 17unlink("afile.new") if -f "afile"; 18print "$!\nnot " unless open($f,"+>afile") && open($f, "+<", "afile"); 19print "ok 1\n"; 20print "$!\nnot " unless binmode($f); 21print "ok 2\n"; 22print "not " unless -f "afile"; 23print "ok 3\n"; 24print "not " unless print $f "SomeData\n"; 25print "ok 4\n"; 26print "not " unless tell($f) == 9; 27print "ok 5\n"; 28print "not " unless printf $f "Some %d value\n",1234; 29print "ok 6\n"; 30print "not " unless seek($f,0,0); 31print "ok 7\n"; 32$b = <$f>; 33print "not " unless $b eq "SomeData\n"; 34print "ok 8\n"; 35print "not " if eof($f); 36print "ok 9\n"; 37read($f,($b=''),4); 38print "'$b' not " unless $b eq 'Some'; 39print "ok 10\n"; 40print "not " unless getc($f) eq ' '; 41print "ok 11\n"; 42$b = <$f>; 43print "not " unless eof($f); 44print "ok 12\n"; 45print "not " unless close($f); 46print "ok 13\n"; 47unlink("afile"); 48