http://qs321.pair.com?node_id=1187165


in reply to Track open file handles

I would see great value in the solution if I saw value in creating the problem it solves. This seems useful perhaps as an aid in the toolkit for refactoring or debugging existing bad code. When writing new code I think it'd be easier, more productive, and less invasive to just keep track of the resources a program needs to use within the program in the first place.

Replies are listed 'Best First'.
Re^2: Track open file handles
by shmem (Chancellor) on Apr 05, 2017 at 18:10 UTC

    Of course yes! Normally there's no need to keep track on file handles, if you use them properly. This module is meant as a tool to track down bugs, and to find out the bugs aren't where you think they are -because bugs are always elsewhere. So maybe it should live in the Devel namespace, e.g. Devel::FileHandle::Track or so.

    ...if I saw value in creating the problem it solves.

    The only value in creating problems is to learn how not to create them in the first place.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

      It could theoretically come in handy as part of a test suite for a distribution that must track handles (because it maintains several at any given time), to ensure none accidentally leak during a run.

      My File::Edit::Portable came to mind immediately. Although there's thorough coverage already, it's one place something like this would be quite useful.