in reply to Parsing the command line: manual or module?
Before I wrote my code in Perl, I was a C programmer. One of the first C applications that I wrote started off as a prototype, and as often happens, the prototype became the working piece of Production code.
One of the routines started out with a few parameters, then grew, finally needing eight or ten parameters. Every time I'd add another, I'd think, "Gee, this is getting really unwieldy".
Well, that's hindsight.
In C, you have no choice but to pass in a long list of parameters .. but in Perl, there's no need to cripple your code with that kind of limitation. As soon as a function requires more than two or three paramters, make them an arg hash. If it's the comman line arguments, use Getopt::Long.
The risks of not using a module are that you'll reinvent your own wheel. This is not a bad thing, except that your solution isn't going to have the attention paid to it that the equivalent module did, and it'll take longer.
That could pay off in the long run, but it might lead to difficult discussions with your manager about why the three week development schedule has expanded out to eight months. Part of being a Senior Developer is knowing when to write it yourself, and when to use something that someone else has written.
Let CPAN make you look good today.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing the command line: manual or module?
by Fletch (Bishop) on Aug 17, 2006 at 19:26 UTC | |
|
Re^2: Parsing the command line: manual or module?
by djp (Hermit) on Aug 18, 2006 at 03:11 UTC | |
by talexb (Chancellor) on Aug 18, 2006 at 03:21 UTC |