• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Data/H29-Apr-2020-2,740981

t/H29-Apr-2020-737485

Build.PLH A D14-Jan-2017851 3330

ChangesH A D29-Apr-20202.8 KiB9973

MANIFESTH A D14-Jan-2017198 1413

META.jsonH A D29-Apr-20202.5 KiB101100

META.ymlH A D29-Apr-20201.6 KiB6362

READMEH A D14-Jan-20171.6 KiB3929

README

1NAME
2
3Data::Domain - Data description and validation
4
5DESCRIPTION
6
7A data domain is a description of a set of values, either scalar or
8structured (arrays or hashes).  The description can include many
9constraints, like minimal or maximal values, regular expressions,
10required fields, forbidden fields, and also contextual
11dependencies. From that description, one can then invoke the domain's
12C<inspect> method to check if a given value belongs to the domain or
13not. In case of mismatch, a structured set of error messages is
14returned, giving detailed explanations about what was wrong.
15
16The motivation for writing this package was to be able to express in a
17compact way some possibly complex constraints about structured
18data. Typically the data is a Perl tree (nested hashrefs or arrayrefs)
19that may come from XML, L<JSON|JSON>, from a database through
20L<DBIx::DataModel|DBIx::DataModel>, or from postprocessing an HTML
21form through L<CGI::Expand|CGI::Expand>. C<Data::Domain> is a kind of
22tree parser on that structure, with some facilities for dealing with
23dependencies within the structure, and with several options to
24finely tune the error messages returned to the user.
25
26The main usage for C<Data::Domain> is to check input from forms in
27interactive applications : the structured error messages make it easy
28to display a form again, highlighting which fields were rejected and
29why. Another usage is for writing automatic tests, with the help of
30the companion module L<Test::InDomain>.
31
32
33COPYRIGHT AND LICENCE
34
35Copyright 2006, 2007, 2012 by Laurent Dami.
36
37This library is free software; you can redistribute it and/or modify
38it under the same terms as Perl itself.
39