in reply to Re: what are all the things to be considered to write a effective perl script or module?
in thread what are all the things to be considered to write a effective perl script or module?

I'm surprised nobody else hit on this yet.

Granted I'm a Perl newbie, this seems like a very important distinction to make -- that a script is a whole different beast from a module.

Even if you weren't planning on redistributing (and thus documenting, speed testing - beyond your own desires, etc.), the testing is essential for the module. And even if the Carp module doesn't blow up your computer, if it's defective it could cause some headaches in scripts you're trying to run with it.


Anyways, in response to your original question, here's my $0.02. Whenever I need to write a script, a function, whatever, I've found it's definitely easiest to whip out some sort of text editor, and plan out what you need to do.

Generally the process involves first listing what I want to do, and then what design constraints are in place. I agree with all above posters who have said that your first goal is to make it work. Worry about benchmarking and beautification later. With that done, I'll plan out in English a few methods for going about this -- it's easier to see what makes sense and what doesn't this way, no matter how comfortable you are with code. With that in mind, I'll start adding code, and eventually piece them together.
(Then comes the testing, documentation wherever it needs to go, and cleanup).
  • Comment on Re^2: what are all the things to be considered to write a effective perl script or module?