good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: Track open file handlesby shmem (Chancellor) |
on Apr 06, 2017 at 08:52 UTC ( [id://1187229]=note: print w/replies, xml ) | Need Help?? |
Without Hash::Util::FieldHash, no reference to the filehandle is kept anywhere (since the hash would only keep a stringified version) But this stringified key / value pair would not be destroyed if its object goes out of scope. It is just that what Hash::Util::FieldHash does for me - the housekeeping. Why shouldn't I use it? I think returning the filehandle is a good idea ... Maybe you can keep a weakened reference to the handle though Again, that is what Hash::Util::FieldHash does for me. It keeps a weakened reference and uses the decimal value of the adress part (0xdeadbeef) as key into the fieldhash. The weakened reference has magic attached which provides for deletion of the hash entry when it's freed. But! returning a weakened reference from get_fds is a good idea. Thank you.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
In Section
Cool Uses for Perl
|
|