in reply to Re^2: Getopt::Declare replacement?
in thread Getopt::Declare replacement?

Argument parsing and checking also serves as the documentation.
Don't get me wrong, your pointer to the tutorial is excellent.

I was just hoping that actually specifying the option spec would create the pod, or vice-versa. I prefer to define everything once and only once. This includes the strings used in the options spec, which are also used in the usage, and in the documentation (if I can wedge them in everywhere) -- I usually put those in variables, and reuse them or derive other stuff from them. I use string variables and use strict vars so that if I misspell something, it's a variable name, and it's caught by Perl, instead of my curmudgeonly user.

I also realize that I can't have everything. (If it was easy, someone else would have a solution in the core already :) So I should spend some time and see if I can make pod work the same way as G:D.

I'm also lazy in that I'm trying to combine usage and documentation. I should probably cut back on the usage, and split out the documentation. If I put the full docs into a sub, one of the options can call it. (Or I can go the pod2usage route...though in some sense that's got the same trouble in reverse.)

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^4: Getopt::Declare replacement?
by john_oshea (Priest) on May 08, 2006 at 11:05 UTC

    Maybe Getopt::Euclid? From the synopsis:

    Getopt::Euclid uses your program's own documentation to create a command-line argument parser. This ensures that your program's documented interface and its actual interface always agree.