print "1..$c\n";
my $set_out = '';
-$set_out = "binmode STDOUT, ':crlf'" if $main::use_crlf = 1;
+$set_out = "binmode STDOUT, ':crlf'"
+ if defined $main::use_crlf && $main::use_crlf == 1;
sub testread ($$$$$$$) {
my ($fh, $str, $read_c, $how_r, $write_c, $how_w, $why) = @_;
} else {
die "Unrecognized write: '$how_w'";
}
- binmode $fh, ':crlf' if $main::use_crlf = 1;
+ binmode $fh, ':crlf'
+ if defined $main::use_crlf && $main::use_crlf == 1;
testread($fh, $str, $read_c, $how_r, $write_c, $how_w, "pipe$why");
}
open my $fh, '>', 'io_io.tmp' or die;
select $fh;
- binmode $fh, ':crlf' if $main::use_crlf = 1;
+ binmode $fh, ':crlf'
+ if defined $main::use_crlf && $main::use_crlf == 1;
if ($how_w eq 'print') { # AUTOFLUSH???
$| = 0;
print $fh $_ for @data;
}
close $fh or die "close: $!";
open $fh, '<', 'io_io.tmp' or die;
- binmode $fh, ':crlf' if $main::use_crlf = 1;
+ binmode $fh, ':crlf'
+ if defined $main::use_crlf && $main::use_crlf == 1;
testread($fh, $str, $read_c, $how_r, $write_c, $how_w, "file$why");
}
ok(1, 'open pipe');
binmode $fh, q(:crlf);
ok(1, 'binmode');
-my (@c, $c);
+$c = undef;
+my @c;
push @c, ord $c while $c = getc $fh;
ok(1, 'got chars');
is(scalar @c, 9, 'got 9 chars');