Dave's Free Press

Technology: Params-Validate-Dependencies-all_or_none_of-1.01

 

Older stuff

No Title


NAME

Params::Validate::Dependencies::all_or_none_of


DESCRIPTION

An extension for Params::Validate::Dependencies to validate that either all of or none of a list of params are present.


SYNOPSIS

In this example, the 'foo' function takes named arguments, of which the 'day', 'month', and 'year' args must either all be present or none of them be present.

  use Params::Validate::Dependencies qw(:all);
  use Params::Validate::Dependencies::all_or_none_of;
  sub foo {
    validate(@_,
      { ... normal Params::Validate stuff ...},
      all_or_none_of(qw(day month year))
    );
  }


SUBROUTINES and EXPORTS

all_or_none_of

This is exported by default. It takes a list of scalars and code-refs and returns a code-ref which checks that the hashref it receives matches either all or none of the options given.


LIES

Some of the above is incorrect. If you really want to know what's going on, look at Params::Validate::Dependencies::Extending.


BUGS, LIMITATIONS, and FEEDBACK

I like to know who's using my code. All comments, including constructive criticism, are welcome.

Please report any bugs either by email or using http://rt.cpan.org/ or at https://github.com/DrHyde/perl-modules-Params-Validate-Dependencies/issues.

Bug reports should contain enough detail that I can replicate the problem and write a test. The best bug reports have those details in the form of a .t file. If you also include a patch I will love you for ever.


SEE ALSO

Params::Validate::Dependencies

Data::Domain::Dependencies


SOURCE CODE REPOSITORY

git://github.com/DrHyde/perl-modules-Params-Validate-Dependencies-all_or_none_of.git

https://github.com/DrHyde/perl-modules-Params-Validate-Dependencies-all_or_none_of/


COPYRIGHT and LICENCE

Copyright 2011 David Cantrell <david@cantrell.org.uk>

This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.


CONSPIRACY

This module is also free-as-in-mason.