Is there a reason why opendir doesn’t have the same policy than open in Perl Best Practices?
I’m thinking about at least these 2 policies:
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The original rule from Perl Best Practices (for the first Policy you mention) was
which applies to much more than just
open. Perl::Critic is based in large part on PBP but it does differ (from the perldoc):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
open. I would suggest submitting a bug on CPAN (looking at the code, it would only be a one line change).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.
Correction: it’s a little different but the closest rule in PBP for the second Policy is
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).