perl 5.003_06: pod/perlcall.pod pod/perldata.pod pod/perldebug.pod pod/perlembed...
[p5sagit/p5-mst-13.2.git] / t / lib / filehand.t
CommitLineData
c07a80fd 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require Config; import Config;
1cf326cf 7 if ($Config{'extensions'} !~ /\bFileHandle\b/ && $^O ne 'VMS') {
c07a80fd 8 print "1..0\n";
9 exit 0;
10 }
11}
12
13use FileHandle;
14use strict subs;
15
16$mystdout = new_from_fd FileHandle 1,"w";
5ef887f5 17$| = 1;
c07a80fd 18autoflush $mystdout;
19print "1..4\n";
20
21print $mystdout "ok ",fileno($mystdout),"\n";
22
23$fh = new FileHandle "TEST", O_RDONLY and print "ok 2\n";
24$buffer = <$fh>;
25print $buffer eq "#!./perl\n" ? "ok 3\n" : "not ok 3\n";
26
5ef887f5 27ungetc $fh 65;
28CORE::read($fh, $buf,1);
c07a80fd 29print $buf eq 'A' ? "ok 4\n" : "not ok 4\n";