Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 544473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:39:31+00:00 2026-05-13T10:39:31+00:00

Is there a reason why opendir doesn’t have the same policy than open in

  • 0

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:

  • Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles
  • Perl::Critic::Policy::InputOutput::RequireBriefOpen
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:39:32+00:00Added an answer on May 13, 2026 at 10:39 am

    The original rule from Perl Best Practices (for the first Policy you mention) was

    Don’t use bareword filehandles

    which applies to much more than just open. Perl::Critic is based in large part on PBP but it does differ (from the perldoc):

    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. However, Perl::Critic is not limited to PBP and will even support Policies that contradict Conway.

    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

    Close filehandles explicitly, and as soon as possible.

    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).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any reason to use one over the other? Do they have the
Is there any reason to use 1.8.7 over 1.9.1 or is it always best
Is there any reason that MVC isn't equally useful for desktop apps as for
Is there a reason why std::type_info is specified to be polymorphic? The destructor is
Is there any reason for Scala not support the ++ operator to increment primitive
Is there any reason why a route would be properly mapped in one environment
Is there any reason an asp CompareValidator validates after postback. ie everything runs when
For some reason there is a pause after the program below starts. I believe
Is there are a reason why android menu icons are always monochrome and not
I am trying to write a php function to save and then display comments

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.