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
|
|