fix IO::File to support binmode
[p5sagit/p5-mst-13.2.git] / ext / IO / t / io_xs.t
CommitLineData
61f2b451 1#!./perl
61f2b451 2
3BEGIN {
7a4c00b4 4 unless(grep /blib/, @INC) {
5 chdir 't' if -d 't';
20822f61 6 @INC = '../lib';
7a4c00b4 7 }
8}
9
10use Config;
11
12BEGIN {
d846159b 13 if($ENV{PERL_CORE}) {
14 if ($Config{'extensions'} !~ /\bIO\b/) {
15 print "1..0 # Skip: IO extension not built\n";
7a4c00b4 16 exit 0;
17 }
61f2b451 18 }
d846159b 19 if( $^O eq 'VMS' && $Config{'vms_cc_type'} ne 'decc' ) {
20 print "1..0 # Skip: not compatible with the VAXCRTL\n";
21 exit 0;
22 }
61f2b451 23}
24
25use IO::File;
26use IO::Seekable;
27
1e9fe98f 28print "1..4\n";
fefb1980 29
61f2b451 30$x = new_tmpfile IO::File or print "not ";
31print "ok 1\n";
32print $x "ok 2\n";
33$x->seek(0,SEEK_SET);
34print <$x>;
fefb1980 35
36$x->seek(0,SEEK_SET);
37print $x "not ok 3\n";
38$p = $x->getpos;
39print $x "ok 3\n";
40$x->flush;
41$x->setpos($p);
42print scalar <$x>;
43
44$! = 0;
45$x->setpos(undef);
46print $! ? "ok 4 # $!\n" : "not ok 4\n";
a6a714bd 47