|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package FormValidator::Simple::Constraint;  | 
| 
2
 | 
25
 | 
 
 | 
 
 | 
  
25
  
 | 
 
 | 
34005
 | 
 use strict;  | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
47
 | 
    | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1080
 | 
    | 
| 
3
 | 
25
 | 
 
 | 
 
 | 
  
25
  
 | 
 
 | 
131
 | 
 use base qw/Class::Accessor::Fast/;  | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
45
 | 
    | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2982
 | 
    | 
| 
4
 | 
25
 | 
 
 | 
 
 | 
  
25
  
 | 
 
 | 
6526
 | 
 use FormValidator::Simple::Exception;  | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
67
 | 
    | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
234
 | 
    | 
| 
5
 | 
25
 | 
 
 | 
 
 | 
  
25
  
 | 
 
 | 
16865
 | 
 use FormValidator::Simple::Validator;  | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
96
 | 
    | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
390
 | 
    | 
| 
6
 | 
25
 | 
 
 | 
 
 | 
  
25
  
 | 
 
 | 
1225
 | 
 use FormValidator::Simple::Constants;  | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
59
 | 
    | 
| 
 
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12871
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __PACKAGE__->mk_accessors(qw/name command negative args/);  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
11
 | 
173
 | 
 
 | 
 
 | 
  
173
  
 | 
  
1
  
 | 
8878
 | 
     my $class = shift;  | 
| 
12
 | 
173
 | 
 
 | 
 
 | 
 
 | 
 
 | 
561
 | 
     my $self  = bless { }, $class;  | 
| 
13
 | 
173
 | 
 
 | 
 
 | 
 
 | 
 
 | 
451
 | 
     $self->_init(@_);  | 
| 
14
 | 
173
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1381
 | 
     return $self;  | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _init {  | 
| 
18
 | 
173
 | 
 
 | 
 
 | 
  
173
  
 | 
 
 | 
274
 | 
     my ($self, $setting) = @_;  | 
| 
19
 | 
173
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
369
 | 
     if (ref $setting) {  | 
| 
20
 | 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
123
 | 
         my($name, @args) = @$setting;  | 
| 
21
 | 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
145
 | 
         $self->name($name);  | 
| 
22
 | 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
424
 | 
         $self->args( [@args] );  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     } else {  | 
| 
24
 | 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
352
 | 
         $self->name($setting);  | 
| 
25
 | 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
981
 | 
         $self->args( [] );  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
27
 | 
173
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1071
 | 
     $self->_check_name;  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _check_name {  | 
| 
31
 | 
173
 | 
 
 | 
 
 | 
  
173
  
 | 
 
 | 
263
 | 
     my $self = shift;  | 
| 
32
 | 
173
 | 
 
 | 
 
 | 
 
 | 
 
 | 
447
 | 
     my $name = $self->name;  | 
| 
33
 | 
173
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
1112
 | 
     if($name =~ /^NOT_(.+)$/) {  | 
| 
34
 | 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
220
 | 
         $self->command($1);  | 
| 
35
 | 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
523
 | 
         $self->negative( TRUE );  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     } else {  | 
| 
37
 | 
104
 | 
 
 | 
 
 | 
 
 | 
 
 | 
314
 | 
         $self->command($name);  | 
| 
38
 | 
104
 | 
 
 | 
 
 | 
 
 | 
 
 | 
681
 | 
         $self->negative( FALSE );  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub check {  | 
| 
43
 | 
109
 | 
 
 | 
 
 | 
  
109
  
 | 
  
0
  
 | 
167
 | 
     my ($self, $params) = @_;  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
294
 | 
     my $command = $self->command;  | 
| 
46
 | 
109
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1214
 | 
     FormValidator::Simple::Exception->throw(  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         qq/Unknown validation "$command"./  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ) unless FormValidator::Simple::Validator->can($command);  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
50
 | 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
338
 | 
     my ($result, $data) = FormValidator::Simple::Validator->$command($params, $self->args);  | 
| 
51
 | 
109
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
355
 | 
     $result = not $result if $self->negative;  | 
| 
52
 | 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
871
 | 
     return ($result, $data);  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
56
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |