Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

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

Well, I'd hate to work somewhere that was so perscriptive about how I wrote my code, but here are some specific points:

2. use HTML::Template not HERE documents

HTML::Template and here docs don't really do the same thing (except in a few narrow areas) so that doesn't really make sense. And besides, the Template Toolkit is better :)

5. OO always to be used where possible

That's just silly. It's almost always possible to use OO. It's not always appropriate tho'.

6. Pass by reference

I don't think that means what you think it means. I think you mean "pass references to datastructures into subroutines".

15. Always retrieve database rows into hash reference not arrays

A more usefule rule would be "always explicitly name selected columns in an SQL statement" (aka "don't use SELECT *").

16. Use CGI CARP

What? Even if I'm not writing a CGI program?

17. Assign CGI parameters to hashes

Why?

22. Program flow control to be places in 'main' method

I really don't understand the point of that.

23. No Global Variables

What do you mean by "global variables"? If you mean file-scoped lexicals then they should be avoided, but can often be useful. If you mean package variables then they are often the only to achieve certain things (like sharing variables between packages).

24. use my not local

But there are times when only local will work. I think you meant "prefer lexical variables over package variables".

26. Always use CGI.pm

Again, that seems a bit silly if you're not writing a CGI program.

28. Do not use $_

That rule alone would be sufficient grounds for me to resign on the spot!

29. Do no use goto

At the very least you should make and exception for "goto &sub".

30. Initialise variables

Why? Perl initialises all variable with sensible values.

31. Error handling done using Begin blocks at CGI level. All dies are logged

Another rule that seems unnecessarily CGI-biased.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg


In reply to Re: Perl Programming guidelines/rules by davorg
in thread Perl Programming guidelines/rules by hakkr

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 exploiting the Monastery: (1)
As of 2024-04-16 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found