JupiterHost.Net wrote:
Howdy,
Hello,
http://search.cpan.org/~tjenness/File-Temp-0.16/Temp.pm#BINMODE
says:
"The file returned by File::Temp will have been opened in binary mode if
such a mode is available. If that is not correct, use the binmode()
function to change the mode of the filehandle."
perldoc -f binmode
doesn't seem to touch on how to "use the binmode() function to change
the mode of the filehandle." back to ascii mode.
Anyone know how that's done or what part I missed ;)
perldoc -f binmode
binmode FILEHANDLE, LAYER
^^^^^
binmode FILEHANDLE
Arranges for FILEHANDLE to be read or written in "binary" or
"text" mode on systems where the run-time libraries distinguish
between 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 "undef" and sets $! (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 ":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). Note that, despite what may be implied in
"Programming Perl" (the Camel) or elsewhere, ":raw" is not the
simply inverse of ":crlf" -- other layers which would affect
binary nature of the stream are also disabled. See PerlIO,
perlrun and the discussion about the PERLIO environment variable.
The ":bytes", ":crlf", and ":utf8", and any other directives of
the form ":...", are called I/O layers. The "open" pragma can be
used to establish default I/O layers. See open.
Also see:
perldoc PerlIO
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>