From d807c6f47279587c65cc51a3a68d28c6078f0f1d Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sat, 14 Jun 2003 08:05:01 +0000 Subject: [PATCH] Slight reorg of the binmode() entry. p4raw-id: //depot/perl@19773 --- pod/perlfunc.pod | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 8be8c8c..e10ca60 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -457,6 +457,19 @@ binary and text files. If FILEHANDLE is an expression, the value is taken as the name of the filehandle. Returns true on success, otherwise it returns C and sets C<$!> (errno). +On some systems (in general, DOS and Windows-based systems) binmode() +is necessary when you're not working with a text file. For the sake +of portability it is a good idea to always use it when appropriate, +and to never use it when it isn't appropriate. Also, people can +set their I/O to be by default UTF-8 encoded Unicode, not bytes. + +In other words: regardless of platform, use binmode() on binary data, +like for example images. + +If LAYER is present it is a single string, but may contain multiple +directives. The directives alter the behaviour of the file handle. +When LAYER is present using binmode on text file makes sense. + If LAYER is omitted or specified as C<:raw> the filehandle is made suitable for passing binary data. This includes turning off possible CRLF translation and marking it as bytes (as opposed to Unicode characters). @@ -466,6 +479,10 @@ Note that as despite what may be implied in I<"Programming Perl"> I disabled. See L, L and the discussion about the PERLIO environment variable. +The C<:bytes>, C<:crlf>, and C<:utf8>, and any other directives of the +form C<:...>, are called I/O I. The C pragma can be used to +establish default I/O layers. See L. + I -On some systems (in general, DOS and Windows-based systems) binmode() -is necessary when you're not working with a text file. For the sake -of portability it is a good idea to always use it when appropriate, -and to never use it when it isn't appropriate. - -In other words: regardless of platform, use binmode() on binary files -(like for example images). - -If LAYER is present it is a single string, but may contain -multiple directives. The directives alter the behaviour of the -file handle. When LAYER is present using binmode on text -file makes sense. - To mark FILEHANDLE as UTF-8, use C<:utf8>. -The C<:bytes>, C<:crlf>, and C<:utf8>, and any other directives of the -form C<:...>, are called I/O I. The C pragma can be used to -establish default I/O layers. See L. - In general, binmode() should be called after open() but before any I/O is done on the filehandle. Calling binmode() will normally flush any pending buffered output data (and perhaps pending input data) on the -- 1.8.3.1