in reply to Parsing the command line: manual or module?

Whenever caller and callee have to exactly synchronize, with no error checking, you will tend to get bugs because people will sometimes make mistakes.

The hand-rolled parsing in this case requires exactly this kind of synchronization, and lacks error checks.

Using Getopt::Long allows for more flexibility and better error checking. On the one hand you'll get fewer errors because, for instance, getting arguments in the wrong order won't be a problem. On the other hand when there are errors, you are more likely to be told about it so they won't survive. Both are Good Things.

Less code, easier maintainance, etc are just icing on the cake.

  • Comment on Re: Parsing the command line: manual or module?