Re: How to local-ly close a handle?




Quoth "Ferry Bolhar" <bol@xxxxxxxxxxxxxxxxx>:
Ben Morrow:

The fd you closed will remain closed, but the Perl filehandle will
revert to pointing to its old fd, and thus will be open again. :)

....unless you've closed the old fd as well in the meantime.

But the OP wrote:

...then STDERR *is* finally silenced, but it *remains* silenced outside
of the block (e.g. the message from the die statement doesn't show);
i.e. the closing is not localized.

So, this contradicts what you said above, doesn't it?

The OP's example was

local *STDERR = *STDERR;

so in this case old fd == new fd, and obviously closing one closes the
other.

Ben

--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
benmorrow@xxxxxxxxxxxxx Groucho Marx
.



Relevant Pages

  • Re: Testing My X-face in Slrn
    ... Peter J Ross wrote: ... and closing double quote, and ends with a pair too. ... Thanks for pointing that out. ...
    (news.software.readers)
  • Re: Yellowstone, here we come
    ... be in and out of YNP from Aug 2 until Oct 2 and will be staying 35 ... miles north of the north entrance. ... No, the lady did not say that they started closing things up then, but I ... "You can say any foolish thing to a dog, ...
    (rec.outdoors.rv-travel)
  • Re: OT:Its the end of the world as we (at our house) know it.
    ... So a little Maltese mix now owns 2 people. ... MoxY...nonononoooooo..the little twirp wants it to be MoxIE!) ... DOG, NOT for Paris Hilton! ... like a weather vane..instantly pointing this way and that..I am easily ...
    (rec.woodworking)
  • Re: True or False? Passed to me by a friend....
    ... station, do I need a sticker on my hood that says, "Remove head and ... hands before closing"? ... homemade POS hat? ... "You can say any foolish thing to a dog, ...
    (rec.outdoors.rv-travel)
  • Re: Files and transfer Cabling
    ... menu, you were NOT implying I was too stupid to live, but it ... And I apologize to both of you for taking your comments in such a ... I was just pointing out something I thought you didn't know. ... "You can say any foolish thing to a dog, ...
    (rec.outdoors.rv-travel)