Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Yes, better. They showed an example of putting the function as an export of a package. There is absolutely no reason to have a package export close over a "my" variable. The only thing that accomplishes is getting in other people's way when they need to customize the behavior of the module. A module that advertises itself as a mini-database of known-bad URLs is more useful when it can be modified.

I believe that the purpose of a module is to provide re-usable code, for whatever purpose the user might need it for. The author has no business dictating what users can or can't do with the code, unless they are legitimately trying to prevent a common mistake they think users will make, and feel that users won't immediately realize it was a mistake.

If the author wants to retain the freedom to make internal changes to a module without potentially breaking other people's customizations, all they need to do is prefix those internals with _ to convey that intent, and the rest of the responsibility is on the user.


In reply to Re^8: Hash versus chain of elsifs by NERDVANA
in thread Hash versus chain of elsifs by mldvx4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2022-05-27 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (94 votes). Check out past polls.

    Notices?