Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Redirection and encoding, broken or WAD?

by robin (Chaplain)
on Jan 05, 2006 at 21:01 UTC ( #521341=note: print w/ replies, xml ) Need Help??


in reply to Redirection and encoding, broken or WAD?

This is an excellent question, and I don't know the answer. The behaviour you describe is surprising, at least to me. The development version of perl exhibits the same behaviour. I wonder whether this is a known limitation, because there is a warning in perlfunc:

Though if you try to re-open C<STDOUT> or C<STDERR> as an "in memory" file, you have to close it first: close STDOUT; open STDOUT, '>', \$variable or die "Can't open STDOUT: $!";
Of course this isn't talking about encodings, but I think it might be the same problem. Unless a PerlIO guru pops up here, I'd suggest asking p5p.

PS. If you just want a minimal demonstration script, you can delete most of your code:

# close STDOUT; # with this it works open STDOUT, ">:encoding(cp37)", "foo.out" or die "Cannot redirect STD +OUT\n"; print "yadda yadda\n";


Comment on Re: Redirection and encoding, broken or WAD?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://521341]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (13)
As of 2014-09-17 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (87 votes), past polls