--- Info.pm 2015-06-15 12:21:41.000000000 +0100 +++ Info.pm-TRY-BINMODE 2015-06-11 01:10:59.000000000 +0100 @@ -94,10 +94,8 @@ if ($self->get_conf('VERBOSE')) { print STDERR "Output file $self->{'output_file'}\n"; } - $fh = $self->Texinfo::Common::open_out($self->{'output_file'}); + $fh = _open_info_file($self, $self->{'output_file'}); if (!$fh) { - $self->document_error(sprintf($self->__("could not open %s for writing: %s"), - $self->{'output_file'}, $!)); return undef; } } @@ -197,13 +195,9 @@ print STDERR "New output file ". $self->{'output_file'}.'-'.$out_file_nr."\n"; } - $fh = $self->Texinfo::Common::open_out ( - $self->{'output_file'}.'-'.$out_file_nr); + $fh = _open_info_file($self, $self->{'output_file'}.'-'.$out_file_nr); if (!$fh) { - $self->document_error(sprintf( - $self->__("could not open %s for writing: %s"), - $self->{'output_file'}.'-'.$out_file_nr, $!)); - return undef; + return undef; } print $fh $complete_header; $self->_update_count_context(); @@ -225,11 +219,8 @@ if ($self->get_conf('VERBOSE')) { print STDERR "Outputing the split manual file $self->{'output_file'}\n"; } - $fh = $self->Texinfo::Common::open_out($self->{'output_file'}); + $fh = _open_info_file($self, $self->{'output_file'}); if (!$fh) { - $self->document_error(sprintf( - $self->__("could not open %s for writing: %s"), - $self->{'output_file'}, $!)); return undef; } $tag_text = $complete_header; @@ -291,6 +282,23 @@ return $result; } +# Wrapper around Texinfo::Common::open_out. Return filehandle or undef on +# failure. +sub _open_info_file($$) +{ + my $self = shift; + my $filename = shift; + my $fh = $self->Texinfo::Common::open_out($filename); + if (!$fh) { + $self->document_error(sprintf($self->__("could not open %s for writing: %s"), + $filename, $!)); + return undef; + } + # We need this for tag tables to be correct under MS-Windows + #binmode $fh; + return $fh; +} + sub _info_header($) { my $self = shift;