Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Getopt-Lucid CPAN distribution.

Report information
The Basics
Id: 62383
Status: open
Priority: 0/
Queue: Getopt-Lucid

People
Owner: Nobody in particular
Requestors: xdaveg [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Skip required
Date: Fri, 22 Oct 2010 17:32:39 -0400
To: bug-Getopt-Lucid [...] rt.cpan.org
From: David Golden <xdaveg [...] gmail.com>
Show quoted text
---------- Forwarded message ---------- From: <xdg@ec2.dagolden.com> Date: Tue, Sep 28, 2010 at 4:20 AM Subject: #toolchain To: xdaveg@gmail.com       rbo> xdg: what do you think about this: http://github.com/rbo/getopt-lucid/tree/skip_required
Show quoted text
>       rbo> xdg: what do you think about this: > http://github.com/rbo/getopt-lucid/tree/skip_required
This "works" but feels kludgy. I'm going to think about other ways to accomplish the same goal.
Work in progress on the github site. C.f. https://github.com/dagolden/getopt-lucid/commit/dc181f7f5e687be4aa8e0a4f1176a19d5d59b30c From new POD: Options object validation The "validate" method should be called on the result of "getopt". This will check that all parameter prerequisites defined by "needs" have been met. It also takes a hashref of arguments. The optional "requires" argument gives an arrayref of parameters that must exist. The reason that object validation is done separate from "getopt" is to allow for better control over different options that might be required or to allow some dependencies (i.e. from "needs") to be met via a configuration file. @spec = ( Param("action")->needs(qw/user password/), Param("user"), Param("password"), ); $opt = Getopt::Lucid->getopt(\@spec); $opt->merge_defaults( read_config() ); # provides 'user' & 'password' $opt->validate({requires => ['action']}); Thoughts about this approach welcome. (I still hope to add some better sugar for "help" options, too.)