| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Hierarchical Data Validation à la Moose |
|
2
|
|
|
|
|
|
|
package Interface::Validation; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
29713
|
use Bubblegum; |
|
|
1
|
|
|
|
|
172751
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
1
|
|
|
1
|
|
733070
|
use Function::Parameters; |
|
|
1
|
|
|
|
|
3178
|
|
|
|
1
|
|
|
|
|
10
|
|
|
6
|
1
|
|
|
1
|
|
912
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Interface::Validation::Specification; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.01_01'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
|
13
|
|
|
|
|
|
|
my $target = caller; |
|
14
|
|
|
|
|
|
|
my $class = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
no strict 'refs'; |
|
17
|
|
|
|
|
|
|
push @{"${target}::ISA"}, __PACKAGE__; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
method initialize { |
|
21
|
|
|
|
|
|
|
# TODO ... |
|
22
|
|
|
|
|
|
|
return Interface::Validation::Specification->new(@_); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
method validate { |
|
26
|
|
|
|
|
|
|
# TODO ... |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=pod |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding UTF-8 |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Interface::Validation - Hierarchical Data Validation à la Moose |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 VERSION |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
version 0.01_01 |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Interface::Validation; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Interface::Validation is an scalable data validation library with interfaces for |
|
52
|
|
|
|
|
|
|
applications of all sizes. The most common usage of Interface::Validation is to |
|
53
|
|
|
|
|
|
|
transform class namespaces into data validation domains where consistency and |
|
54
|
|
|
|
|
|
|
reuse are primary objectives. Interface::Validation provides an extensible |
|
55
|
|
|
|
|
|
|
framework for defining reusable data validation rules. This library is based-on |
|
56
|
|
|
|
|
|
|
the architectural pattern found in L<Validation::Class> and is a Moose-based |
|
57
|
|
|
|
|
|
|
implementation of its successor L<Validation::Interface>. It ships with a |
|
58
|
|
|
|
|
|
|
complete set of pre-defined validations and filters referred to as directives. |
|
59
|
|
|
|
|
|
|
B<Note: This is an early release available for testing and feedback and as such |
|
60
|
|
|
|
|
|
|
is subject to change.> |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The main features included in this framework are; hierarchical data validation; |
|
63
|
|
|
|
|
|
|
trait-like validation rules; validation templates; enabling input filtering |
|
64
|
|
|
|
|
|
|
per-validator before and after validation; a DSL for domain-modeling supporting |
|
65
|
|
|
|
|
|
|
class inheritance; overriding default error messages with localization support; |
|
66
|
|
|
|
|
|
|
creating custom validators; creating custom input filters; a simple plugin |
|
67
|
|
|
|
|
|
|
system; and much more. Interface::Validation promotes DRY (don't repeat |
|
68
|
|
|
|
|
|
|
yourself) code. The main benefit in using Interface::Validation is that the |
|
69
|
|
|
|
|
|
|
architecture is designed to increase the consistency and ease of validating |
|
70
|
|
|
|
|
|
|
hierarchical data input. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=encoding utf8 |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L<Interface::Validation::Whitepaper>, L<Interface::Validation::Cookbook>. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Al Newkirk <anewkirk@ana.io> |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Al Newkirk. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
87
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |