4 unless(grep /blib/, @INC) {
11 require($ENV{PERL_CORE} ? "./test.pl" : "./t/test.pl");
12 plan(tests => ($^O =~ /MSWin32/ ? 9 : 6));
14 my $Class = 'IO::File';
15 my $All_Chars = join '', "\r\n", map( chr, 1..255 ), "zzz\n\r";
17 my $Expect = quotemeta $All_Chars;
20 can_ok( $Class, "binmode" );
22 ### file the file with binary data;
23 ### use standard open to make sure we can compare binmodes
26 open $tmp, ">$File" or die "Could not open '$File': $!";
28 print $tmp $All_Chars;
32 ### now read in the file, once without binmode, once with.
33 ### without binmode should fail at least on win32...
34 if( $^O =~ /MSWin32/ ) {
37 isa_ok( $fh, $Class );
38 ok( $fh->open($File), " Opened '$File'" );
40 my $cont = do { local $/; <$fh> };
41 unlike( $cont, qr/$Expect/, " Content match fails without binmode" );
44 ### now with binmode, it must pass
45 { my $fh = $Class->new;
47 isa_ok( $fh, $Class );
48 ok( $fh->open($File), " Opened '$File' $!" );
49 ok( $fh->binmode, " binmode enabled" );
51 my $cont = do { local $/; <$fh> };
52 like( $cont, qr/$Expect/, " Content match passes with binmode" );