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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link or
or How to display code and escape characters
are good places to start.
|