Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
With respect to this node and perlstyle

I am composing some house rules/guidlines for our CGI programmers. Whilst some may be specific to our shop the idea is to promote good maintainable programming for a team environment. Hopefully this list will set the standards for our code reviews without cramping style to much. I'd appreciate any comments or input from anybody else who has written similar guidlines. I think some security focused rules may make good additions

1. use strict and warnings
2. use HTML::Template not HERE documents
3. no deliberate obfuscation
4. all files must be documented with POD (Author, Date created, synopsis, description)
5. OO always to be used where possible
6. Pass by reference
7. No hardcoding of values especially file paths, script names etc
8. Config files or config scripts to be used
9. Do not reinvent wheel always check CPAN
10. minimise coupling
11. maximise cohesion
12. maximise reuse
13. Always indent logic
14. Any reused code block above 5 lines must become a sub routine
15. Always retrieve database rows into hash reference not arrays
16. Use CGI CARP
17. Assign CGI parameters to hashes
18. Version history at bottom of file
19. All subroutines to be commented
20. Meaningful Subroutine and Variable names to be used
21. Constructors must only create objects
22. Program flow control to be places in 'main' method
23. No Global Variables
24. use my not local
25. All Perl filehandles should be in all uppercase
26. Always use CGI.pm
27. Use verbs for subroutines, use nouns for variables, be descriptive and consistent.
28. Do not use $_
29. Do no use goto
30. Initialise variables
31. Error handling done using Begin blocks at CGI level. All dies are logged
32. Where code returns a result it should do so or die with a meaningful error and $!
END

In reply to 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 admiring the Monastery: (6)
As of 2024-04-25 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found