Perl: the Markov chain saw | |
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." In reply to Re: Perl Programming guidelines/rules
by davorg
|
|