line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Constraint::Any; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
78343
|
use warnings; |
|
88
|
|
|
|
|
210
|
|
|
88
|
|
|
|
|
2754
|
|
4
|
88
|
|
|
88
|
|
481
|
use strict; |
|
88
|
|
|
|
|
296
|
|
|
88
|
|
|
|
|
2906
|
|
5
|
88
|
|
|
88
|
|
617
|
use base 'HTML::Widget::Constraint'; |
|
88
|
|
|
|
|
195
|
|
|
88
|
|
|
|
|
23025
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
HTML::Widget::Constraint::Any - Any Constraint |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $c = $widget->constraint( 'Any', 'foo', 'bar' ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
One or more of the named fields must be present. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 process |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub process { |
26
|
4
|
|
|
4
|
1
|
8
|
my ( $self, $w, $params ) = @_; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
6
|
my $results = []; |
29
|
4
|
|
|
|
|
8
|
my $present = 0; |
30
|
4
|
|
|
|
|
6
|
for my $name ( @{ $self->names } ) { |
|
4
|
|
|
|
|
19
|
|
31
|
8
|
100
|
|
|
|
75
|
unless ( $params->{$name} ) { |
32
|
7
|
|
|
|
|
28
|
push @$results, HTML::Widget::Error->new( |
33
|
|
|
|
|
|
|
{ name => $name, message => $self->mk_message } ); |
34
|
|
|
|
|
|
|
} |
35
|
1
|
|
|
|
|
9
|
else { $present++ } |
36
|
|
|
|
|
|
|
} |
37
|
4
|
50
|
|
|
|
56
|
$present = $self->not ? !$present : $present; |
38
|
4
|
100
|
|
|
|
51
|
return $present ? [] : $results; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 default_message |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
7
|
|
|
7
|
1
|
106
|
sub default_message {'Alternative Missing'} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 render_errors |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Arguments: @names |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
A list of element names for which an error should be displayed. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
If this is not set, the default behaviour is for the error to be displayed |
54
|
|
|
|
|
|
|
for all of the Constraint's named elements. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Sebastian Riedel, C |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 LICENSE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
63
|
|
|
|
|
|
|
the same terms as Perl itself. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |