Re: Determining IO layer set on filehandle

2010-02-01 Thread Michael Ludwig
Am 29.01.2010 um 16:10 schrieb Aristotle Pagaltzis: * Michael Ludwig michael.lud...@xing.com [2010-01-29 15:50]: Like, does it work on all platforms? Ouch, good question. I don’t know whether Win32 supports dup’ing. I tried it out, it does. Same syntax, cross-platform. -- Michael.Ludwig

Determining IO layer set on filehandle

2010-01-29 Thread Michael Ludwig
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. sub out_bin { binmode

Re: Determining IO layer set on filehandle

2010-01-29 Thread Michael Ludwig
Am 29.01.2010 um 15:37 schrieb Aristotle Pagaltzis: * Michael Ludwig michael.lud...@xing.com [2010-01-29 14:20]: Is there an alternative way to achieve what I want, maybe involving one of the IO modules? You may want to just dup the filehandle and then diddle the dup’d one. You may need to

Re: Determining IO layer set on filehandle

2010-01-29 Thread Nicholas Clark
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

Re: Determining IO layer set on filehandle

2010-01-29 Thread Michael Ludwig
Am 29.01.2010 um 17:28 schrieb Nicholas Clark: 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

Re: Determining IO layer set on filehandle

2010-01-29 Thread Aristotle Pagaltzis
* Michael Ludwig michael.lud...@xing.com [2010-01-29 18:30]: It appears you can use that information to restore a filehandle configuration: # Gut: STDOUT duplizieren und Duplikat umstellen. # STDOUT (global) wird nicht verstellt. sub out_bin_good { open my $fh, 'STDOUT' or die dup