Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^5: Track open file handles

by Eily (Monsignor)
on Apr 06, 2017 at 09:15 UTC ( #1187235=note: print w/replies, xml ) Need Help??

in reply to Re^4: Track open file handles
in thread Track open file handles

Why shouldn't I use it?

You should, I misread your answer actually (I thought you said the hash would prevent the deletion of the handles), I agree with you that this feature is useful.

But! returning a weakened reference from get_fds is a good idea. Thank you.

Adding it at the last moment, or storing it as a member as soon as the handle is opened (even if that means having two weak reference to the same handle in nearly the same place) is pretty much the same thing. There's a difference when you return $fd => { fd => $fd, %{$fd{$_}} } rather than id_2obj($_) => $fd{$_} though, in the first case, if the user keeps the hashref, it will always have the values it had when acquired, while in the latter, the "close" and "closetime" value will appear when the handle is closed. I like the first version better, because you have to call get_fds to get up-to-date information.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2022-05-25 23:14 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (91 votes). Check out past polls.