Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Getopt::Declare replacement?

by revdiablo (Prior)
on May 07, 2006 at 23:02 UTC ( [id://547939]=note: print w/replies, xml ) Need Help??


in reply to Getopt::Declare replacement?

Perhaps take a look at Pod::Usage. It's even a core module as of Perl 5.6

Update: Ah, I missed that you want argument parsing too. Pod::Usage works fine in conjunction with Getopt::Long, though if you want an all-in-one, it may not be what you're looking for.

Replies are listed 'Best First'.
Re^2: Getopt::Declare replacement?
by atcroft (Abbot) on May 08, 2006 at 00:03 UTC
      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

        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://547939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-23 23:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found