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