in reply to Propose addition to use warnings?

Hi perldigious,

To answer the other part of your question: If you wanted to propose a new warning, you'd do so to the Perl 5 Porters, perhaps as a new "wishlist" priority bug report. However, from being a lurker on P5P for quite some time, I don't think a new warning would be added without there being a lot of usefulness to it, and the warning, its implications, implementation etc. need to be well thought-out. Also, a lot of things can be done outside core Perl, for example, obvious re-uses of a filehandle, at least in the same lexical scope, could be detected with a Perl::Critic policy, perhaps based on a modified Perl::Critic::Policy::InputOutput::RequireBriefOpen. Of course, another way to prevent your bug would be to be more careful with the lexical scoping of filehandle variables ;-)

Hope this helps,
-- Hauke D

Replies are listed 'Best First'.
Re^2: Propose addition to use warnings?
by perldigious (Priest) on Nov 28, 2016 at 18:37 UTC

    Thanks haukex, good to know what the mechanism is, though I sort of figured it would be presumptuous of me to suggest it officially without asking the Monastery first, which is why I did.

    Of course, another way to prevent your bug would be to be more careful with the lexical scoping of filehandle variables

    Yes, that is most certainly the best solution. I have this habit of declaring all my filehandles in the global scope and opening them all right away as a first step in my programs just to force the user to make sure all the the input files are accounted for before my program goes off and spends a bunch of time processing some of them only to find later one or more is missing and it has to die anyway. It's probably an amateurish thing to do.

    Just another Perl hooker - will code for food