line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Constraint::Equal; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
75292
|
use warnings; |
|
88
|
|
|
|
|
203
|
|
|
88
|
|
|
|
|
2785
|
|
4
|
88
|
|
|
88
|
|
518
|
use strict; |
|
88
|
|
|
|
|
187
|
|
|
88
|
|
|
|
|
4512
|
|
5
|
88
|
|
|
88
|
|
466
|
use base 'HTML::Widget::Constraint'; |
|
88
|
|
|
|
|
186
|
|
|
88
|
|
|
|
|
31318
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
HTML::Widget::Constraint::Equal - Equal Constraint |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $c = $widget->constraint( 'Equal', 'foo', 'bar' ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Equal Constraint. All provided elements must be the same. Combine this |
18
|
|
|
|
|
|
|
with the All constraint to make sure all elements are equal. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 process |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub process { |
27
|
4
|
|
|
4
|
1
|
10
|
my ( $self, $w, $params ) = @_; |
28
|
4
|
|
|
|
|
10
|
my $results = []; |
29
|
4
|
|
|
|
|
9
|
my $equal = $params->{ ${ $self->names }[0] }; |
|
4
|
|
|
|
|
19
|
|
30
|
4
|
|
|
|
|
30
|
my $failures = 0; |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
5
|
for my $name ( @{ $self->names } ) { |
|
4
|
|
|
|
|
17
|
|
33
|
12
|
100
|
|
|
|
58
|
$failures++ if $params->{$name} ne $equal; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
4
|
100
|
|
|
|
15
|
if ($failures) { |
37
|
3
|
|
|
|
|
5
|
for my $name ( @{ $self->names } ) { |
|
3
|
|
|
|
|
11
|
|
38
|
9
|
|
|
|
|
118
|
push @$results, HTML::Widget::Error->new( |
39
|
|
|
|
|
|
|
{ name => $name, message => $self->mk_message } ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
43
|
return $results; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 render_errors |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Arguments: @names |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
A list of element names for which an error should be displayed. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
If this is not set, the default behaviour is for the error to be displayed |
53
|
|
|
|
|
|
|
for all of the Constraint's named elements. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Marcus Ramberg, C |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 LICENSE |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
62
|
|
|
|
|
|
|
the same terms as Perl itself. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |