Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

(tye)Re2: Closing and re-opening the DATA Filehandle

by tye (Sage)
on Apr 05, 2001 at 18:37 UTC ( #70117=note: print w/replies, xml ) Need Help??

in reply to Re: (tye)Re: Closing and re-opening the DATA Filehandle
in thread Closing and re-opening the DATA Filehandle

My mistake. I know this doesn't matter since you found a better solution but this bugged me and I found my mistake.

I was thinking that the "=" in "<&=" was required when using a numeric file descriptor. But the "=" requests an fdopen() instead of a dup(), that is, the new file handle ends up sharing the same file descriptor with the old file handle. So when $fh is closed (triggered when it goes out of scope and gets destroyed), the file descriptor that DATA is using also gets closed out from under it.

So just drop the "=" and my code works.

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re2: Closing and re-opening the DATA Filehandle

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2021-03-09 07:31 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (132 votes). Check out past polls.