Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

constant.pm actually is creating subroutines. I picked up a copy of Perl Best Practices, in which Damian Conway recommends Readonly.pm for the exact reasont that you stated.

I'm not sure what you're looking for here. The "best practices" are constantly evolving as new and interesting modules enter the fray. Program the way that makes sense to you. Following best practices is encouraged but not required and not always the best solution.

Typically uppercase subroutines signify that they'll be called by some internals. This isn't set in stone as heredocs and labels typcially use all caps as well. Generally you need to establish context to determine how in accordance with best practice a particular piece of code is.

It makes sense for a constant to be a variable, which is why I like Readonly. I have run into issues where a Readonly array is actually useful. It doesn't happen daily, but when it does rear it's head, I like to address it with Readonly.pm rather than some copying hack.

If you want to get into the philosophy of when and where to hold down shift, perhaps starting a thread on Meditations would be a better fit.

-brad..

In reply to Re^3: Constant names come into conflict with Perl style? by reyjrar
in thread Constant names come into conflict with Perl style? by dmitri

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 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?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found