The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::Domain::Dependencies

DESCRIPTION

Provides functions and objects to let Data::Domain use the same functions as Params::Validate.

SYNOPSIS

This creates a domain which, when passed a hashref, to inspect, will check that it contains at least one of an 'alpha' or 'beta' key, or both of 'foo' and 'bar'.

  use Data::Domain::Dependencies qw(:all);

  my $domain = Dependencies(
    any_of(
      qw(alpha beta),
      all_of(qw(foo bar))
    )
  );

  my $errors = $domain->inspect(\%somehash);

SUBROUTINES and EXPORTS

Nothing is exported by default, but you can export any of the *_of functions of Params::Validate::Dependencies, and the 'Dependencies' function. They are all available under the 'all' tag.

Dependencies

This takes a code-ref argument. That code-ref should take a hash-ref as its argument and return true if the hash-ref passes validation, false otherwise.

'Dependencies' will return an object wrapped around that code-ref whoise 'inspect' method will, if the code-ref returns true, return nothing, or if false, return an error.

new

'Dependencies' above is really just a thin wrapper around this constructor, which simply takes a code-ref argument. You are encouraged to not call this directly.

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

SOURCE CODE REPOSITORY

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

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

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.