ahem, poj called it when he said
I saw it too when i looked at the SendMail code, he even used the same global filename and varlable that they did.# equivalent Mail:Sendmail code open S,'>','socket' or die; my $oldfh = select(S); $| = 1; select($oldfh); close S;
notice he says
Did you try that?# select(STDOUT); # uncomment to fix
And notice he credits choroba for mentioning the fix first
I am mentioning this AGAIN because i understand how frustrating it can be when "someone" skips the actual fix, and wanders away in all odd directions instead.select $stdout;
The trouble comes from my($oldfh) = select(S); $| = 1; select($oldfh); at http://cpansearch.perl.org/src/ABELTJE/Test-Smoke-1.72/lib/inc/Mail/Sendmail.pm. Note that at the time of my($oldfh) = select(S); the selected default output (while maybe seeming to be *STDOUT) is infact $fh via *STDOUT, so that reselect at the end points directly to $fh rather than back at STDOUT as you might think at first thought. See restoring *STDOUT = $stdout; doesnt do much good when the default print file is directly set to $fh by the select.
And just as a lark, seeing this
brought back memories of doing things before i knew of use IO::Socket;, Hardly thought of in maybe 15 years, still works tho, well kinda. If you were to use low level sockets, (for some comparability reasons id suspect,) is there another way to unbuffer a file than to select it and set $|?unless ( socket S, AF_INET, SOCK_STREAM, (getprotobyname 'tcp')[2] ) { return fail("socket failed ($!)")
In reply to Re^4: STDERR Restore after redirect
by huck
in thread STDERR Restore after redirect
by tultalk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |