Jay Savage wrote:
On Tue, Jul 21, 2009 at 9:25 AM, Shawn H. Corey<shawnhco...@gmail.com> wrote:
John W. Krahn wrote:
[snip]
close(STDERR);
open(STDOUT , '>') || die "Unable to open STDOUT: $!";
You're not opening STDOUT to anything. And you closed STDERR so the die
message can't go anywhere. In fact, it goes into an infinite loop.
No it doesn't, there is no loop there.
It goes into an infinite loop on my machine. I suggest you try it before
you make such blanket statements.
[snip]
What version of perl are you using, and on what OS? The following
returns immediately on any system I've ever seen, and I can't find
anything in the docs to the contrary:
$ perl -e 'close(STDERR); die "help!"'
I do see that there were bug reports for problems caused by closing
STDERR in 5.6.2 on some versions of Windows compiled with certain
compilers with (then) experimental thread support enabled. What you
describe is not mentioned, and the problems were all supposed to have
been resolved in 5.8.0, but if you're seeing a problem perhaps you've
found a new bug, or an old one that still lingers. If so, you may want
to report it. At the very least it should be documented in perlport or
perlwin32 if the problem exists in the current release and is not
local to your system.
It is reasonable, though, to expect that advice given on this list
will assume that the code will be executed on a system that behaves as
documented.
HTH,
--jay
I'm running Perl 5.8.8 on Ubuntu 8.04 on a Powerbook G4. You're right;
I don't think it's Perl anymore but something in the kernel. Any way,
thanks to this discussion, I have refined my code:
use File::Spec;
open STDERR, '>', File::Spec->devnull() or exit -1;
And before you tell me I should upgrade my computer, don't bother.
Because it has one advantage over modern machines: no viruses. My
computer is a very quiet environment in which to work and I kinda like
it that way :)
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
Regardless of how small the crowd is, there is always one in
it who has to find out the hard way that the laws of physics
applies to them too.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/