in reply to How to close all open file descriptors after a fork?
Maybe this is not what you want. But why don't you open all of your FDs as "lexical FHs" (recommended in any case, IMHO) and push them into an @array. You can later close $_ for @ARRAY if needed. (I prefer "lexical FHs" because they will automatically closed on scope exit1 - I'm aware that sockets require an explicit close, though.)
Update: incidentally
- The &-form of sub call is now obsolete and most likely not to do what one expects in most situations unless one really knows what he is doing.
- C-style for loops are legal, but are more error-prone and less reliable, not to say clear, than the corresponding perlish construncts.
1 Or more precisely when no more references exist.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to close all open file descriptors after a fork?
by bart (Canon) on Jul 19, 2005 at 14:38 UTC | |
by blazar (Canon) on Jul 19, 2005 at 14:50 UTC | |
Re^2: How to close all open file descriptors after a fork?
by nneul (Novice) on Jul 19, 2005 at 13:59 UTC | |
by blazar (Canon) on Jul 19, 2005 at 14:06 UTC | |
Re^2: How to close all open file descriptors after a fork?
by nneul (Novice) on Jul 19, 2005 at 14:56 UTC | |
by blazar (Canon) on Jul 19, 2005 at 15:09 UTC |
In Section
Seekers of Perl Wisdom