line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::GUI::constraint; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2123
|
use HTML::Template; |
|
1
|
|
|
|
|
19071
|
|
|
1
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
HTML::GUI::constraint - constraint managing |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 CONSTRAINT |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Module for managing the contraints |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#a list of the messages to use in case a constraint is violated |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my %errorMessages = ( |
31
|
|
|
|
|
|
|
required => 'The input "" is mandatory.' , |
32
|
|
|
|
|
|
|
default => 'The constraint "" is violated. Please correct it.' |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head3 getMessage |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
returns the message corresponding to $constrName filled |
42
|
|
|
|
|
|
|
with the values of $params |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Parameters : |
45
|
|
|
|
|
|
|
constrName : a string containing the name of the constraint |
46
|
|
|
|
|
|
|
params : hash ref containing the values to fill the message |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub getMessage{ |
51
|
0
|
|
|
0
|
1
|
|
my ($params)=@_; |
52
|
0
|
|
|
|
|
|
my $tplTxt = ''; |
53
|
0
|
|
|
|
|
|
my $constrName = $params->{'constraint-name'}; |
54
|
0
|
0
|
|
|
|
|
if (exists $errorMessages{$constrName}){ |
55
|
0
|
|
|
|
|
|
$tplTxt = $errorMessages{$constrName}; |
56
|
|
|
|
|
|
|
}else{ |
57
|
0
|
|
|
|
|
|
$tplTxt = $errorMessages{default}; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
my $tplObj = HTML::Template->new( scalarref => \$tplTxt, |
60
|
|
|
|
|
|
|
option => 'value', |
61
|
|
|
|
|
|
|
die_on_bad_params => 0, |
62
|
|
|
|
|
|
|
); |
63
|
0
|
|
|
|
|
|
$tplObj->param($params); |
64
|
0
|
|
|
|
|
|
return $tplObj->output(); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Jean-Christian Hassler, C<< >> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 BUGS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
75
|
|
|
|
|
|
|
C, or through the web interface at |
76
|
|
|
|
|
|
|
L. |
77
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
78
|
|
|
|
|
|
|
your bug as I make changes. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SUPPORT |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
perldoc HTML::GUI::widget |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
You can also look for information at: |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over 4 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * CPAN Ratings |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item * Search CPAN |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
L |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=back |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright 2007 Jean-Christian Hassler, all rights reserved. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
115
|
|
|
|
|
|
|
under the same terms as Perl itself. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; # End of HTML::GUI::constraint |