perl-unicode

Re: Determining IO layer set on filehandle

2010-01-29 10:28:28
On Fri, Jan 29, 2010 at 02:22:06PM +0100, Michael Ludwig wrote:
Filehandles may have IO layers applied to them, like :utf8 or :raw.
One of the ways to achieve that is to use the binmode() function.

  binmode $fh, ':utf8';

What I want to achieve is to set the STDOUT filehandle to ':raw' and
then to restore the previous IO layers.

Is there a way to determine the IO layers applying to a filehandle
just from the filehandle itself?

I think you want PerlIO::get_layers($fh)

I'm not sure where it's documented.

Nicholas Clark