Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

'needs' is too specific; we need a more flexible test #6

Open
dagolden opened this Issue Mar 27, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@ghost

ghost commented Mar 27, 2013

What we have now is effectively "needs all". What about "needs only one" or "needs any"?

Possibly take a sub reference and let people use Syntax::Keyword::Junction:

use Syntax::Keyword::Junction qw/any one/;

my $spec = [
    Param("foo")->needs( sub { $_ eq any(qw/bar baz/) } ),
    Param("baz")->needs( sub { $_ eq one(qw/quux wibble/) } ),
];

Or, possibly we just make those individual methods (and use junctions internally):

my $spec = [
    Param("foo")->needs_any(qw/bar baz/),
    Param("baz")->needs_one(qw/quux wibble/),
];

randian commented Mar 27, 2013

How about adding "excludes" (or something similar) as well?

Param("foo")->excludes("bar")

means that if foo is specified, bar may not also be specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment