Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The original rule from Perl Best Practices (for the first Policy you mention) was</p> <blockquote> <p>Don't use bareword filehandles</p> </blockquote> <p>which applies to much more than just <code>open</code>. Perl::Critic is based in large part on PBP but it does differ (from the perldoc):</p> <blockquote> <p>Perl::Critic is an extensible framework for creating and applying coding standards to Perl source code. Essentially, it is a static source code analysis engine. Perl::Critic is distributed with a number of Perl::Critic::Policy modules that attempt to enforce various coding guidelines. Most Policy modules are based on Damian Conway's book Perl Best Practices. <strong>However, Perl::Critic is not limited to PBP and will even support Policies that contradict Conway.</strong></p> </blockquote> <p>So the fact that Perl::Critic doesn't enforce the same rule on opendir is probably mostly an oversight. It could also be blamed on the fact that the examples in PBP only use <code>open</code>. I would suggest submitting a bug on CPAN (looking at the code, it would only be a one line change).</p> <p>The second rule doesn't actually come from PBP but it seems to me it is just as applicable to opendir. Again, a bug report to the author on CPAN would be a good idea since it would again only be a one line change. And you might get more specific feedback if in fact it was an intentional decision.</p> <p><strong>Correction:</strong> it's a little different but the closest rule in PBP for the second Policy is</p> <blockquote> <p>Close filehandles explicitly, and as soon as possible.</p> </blockquote> <p>and fixing that policy would be more than a one liner but still relatively easy if the maintainer thought it warranted (and wasn't worried that it would break too much existing code).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload