Re: Perlmonk's "best pratices" in the real worldby sauoq (Abbot)
|on Nov 13, 2003 at 11:43 UTC||Need Help??|
Uhm... use strict; and use warnings;... at least while developing. They will help you catch stupid bugs quicker, leaving you more time to write code or play games.
With everything else you mention, the answer is an old standby: it depends.
I've written many CGI programs without CGI.pm or an alternative like CGI::Simple but most of them have something in common: no user input. Or very simple user input like, say, a path component but no parameters. If I'm processing parameters, I'll use a module that has that has tested code to do it. I've never used CGI::Application.
Sometimes OOP makes sense and sometimes it doesn't. If you aren't comfortable with it and don't care to be, then it doesn't make sense. Simple as that. There's nothing you can do with OOP that you can't do without it, so don't fret over it. Use what you know.
As for templates, if you haven't found a place where you need them yet it's probably because you really haven't needed them. You'll know when you do. Same thing with placeholders. You'll start using them when something breaks because you didn't.
Sometimes you have to look past the specific suggestions to find the more general advice. Often that advice boils down to "don't do work you don't need to" or "don't shoot yourself in the foot." No one can really tell you what is best in your situation.
In the end, most of these are really issues of style. The details matter very little. There are as many ways to write code well as there are good coders. The fundamentals like consistent formatting, appropriate commenting, and rigorous testing are far more important than which of the many MTOWTDI that you choose.
But, you really should use strict; and use warnings;... :-)
-sauoq "My two cents aren't worth a dime.";