Skip to content

Commit 31f0ad9

Browse files
committed
Tidy the SYNOPSIS, but skip syntax checking.
1 parent 2f7ba6e commit 31f0ad9

File tree

3 files changed

+53
-41
lines changed

3 files changed

+53
-41
lines changed

README.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,39 @@ use Data::FormValidator::Constraints::MethodsFactory qw(:set :num :bool);
99

1010
# SET constraints (:set)
1111
constraint_methods => {
12-
status => FV_set(1, qw(new active disabled)),
13-
how_many => FV_set_num(1, (1 .. 20)),
14-
province => FV_set_word(1, "AB QC ON TN NU"),
15-
seen_before => FV_set_cmp(1, sub { $seen{$_[0]} }, qw(foo bar)),
12+
status => FV_set(1, qw(new active disabled)),
13+
how_many => FV_set_num(1, (1 .. 20)),
14+
province => FV_set_word(1, "AB QC ON TN NU"),
15+
seen_before => FV_set_cmp(1, sub { $seen{ $_[0] } }, qw(foo bar)),
1616
}
1717

1818
# NUMERIC constraints (:num)
1919
constraint_methods => {
20-
how_many => FV_clamp(1, 1, 10),
21-
small_amount => FV_lt(1, 3),
22-
large_amount => FV_gt(1, 10),
23-
small_again => FV_le(1, 3),
24-
large_again => FV_ge(1, 10),
20+
how_many => FV_clamp(1, 1, 10),
21+
small_amount => FV_lt(1, 3),
22+
large_amount => FV_gt(1, 10),
23+
small_again => FV_le(1, 3),
24+
large_again => FV_ge(1, 10),
2525
}
2626

2727
# BOOLEAN constraints (:bool)
2828
constraint_methods => {
29-
bad_status => FV_not(
30-
FV_set(1, qw(new active disabled))
31-
),
32-
email => FV_or(
33-
FV_set(1,$current_value),
34-
Data::FormValidator::Constraints::email(),
35-
),
36-
password => FV_and(
37-
FV_length_between(6,32),
38-
my_password_validation_constraint(),
39-
),
29+
# e.g. NOT in the given set
30+
bad_status => FV_not(
31+
FV_set(1, qw(new active disabled))
32+
),
33+
34+
# e.g. either the current value, OR validates as an e-mail address
35+
email => FV_or(
36+
FV_set(1, $current_value),
37+
Data::FormValidator::Constraints::email(),
38+
),
39+
40+
# e.g. valid length, AND matches password validation routine
41+
password => FV_and(
42+
FV_length_between(6, 32),
43+
my_password_validation_constraint(),
44+
),
4045
}
4146
```
4247

dist.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ license = Perl_5
44
copyright_holder = Graham TerMarsch
55

66
[@Author::GTERMARS]
7+
-remove = Test::Synopsis

lib/Data/FormValidator/Constraints/MethodsFactory.pm

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ sub FV_and {
233233

234234
1;
235235

236+
=for stopwords MX num
237+
236238
=head1 NAME
237239
238240
Data::FormValidator::Constraints::MethodsFactory - Create constraints for Data::FormValidator
@@ -243,37 +245,41 @@ Data::FormValidator::Constraints::MethodsFactory - Create constraints for Data::
243245
244246
# SET constraints (:set)
245247
constraint_methods => {
246-
status => FV_set(1, qw(new active disabled)),
247-
how_many => FV_set_num(1, (1 .. 20)),
248-
province => FV_set_word(1, "AB QC ON TN NU"),
249-
seen_before => FV_set_cmp(1, sub { $seen{$_[0]} }, qw(foo bar)),
248+
status => FV_set(1, qw(new active disabled)),
249+
how_many => FV_set_num(1, (1 .. 20)),
250+
province => FV_set_word(1, "AB QC ON TN NU"),
251+
seen_before => FV_set_cmp(1, sub { $seen{ $_[0] } }, qw(foo bar)),
250252
}
251253
252254
# NUMERIC constraints (:num)
253255
constraint_methods => {
254-
how_many => FV_clamp(1, 1, 10),
255-
small_amount => FV_lt(1, 3),
256-
large_amount => FV_gt(1, 10),
257-
small_again => FV_le(1, 3),
258-
large_again => FV_ge(1, 10),
256+
how_many => FV_clamp(1, 1, 10),
257+
small_amount => FV_lt(1, 3),
258+
large_amount => FV_gt(1, 10),
259+
small_again => FV_le(1, 3),
260+
large_again => FV_ge(1, 10),
259261
}
260262
261263
# BOOLEAN constraints (:bool)
262264
constraint_methods => {
263-
bad_status => FV_not(
264-
FV_set(1, qw(new active disabled))
265-
),
266-
email => FV_or(
267-
FV_set(1,$current_value),
268-
Data::FormValidator::Constraints::email(),
269-
),
270-
password => FV_and(
271-
FV_length_between(6,32),
272-
my_password_validation_constraint(),
273-
),
265+
# e.g. NOT in the given set
266+
bad_status => FV_not(
267+
FV_set(1, qw(new active disabled))
268+
),
269+
270+
# e.g. either the current value, OR validates as an e-mail address
271+
email => FV_or(
272+
FV_set(1, $current_value),
273+
Data::FormValidator::Constraints::email(),
274+
),
275+
276+
# e.g. valid length, AND matches password validation routine
277+
password => FV_and(
278+
FV_length_between(6, 32),
279+
my_password_validation_constraint(),
280+
),
274281
}
275282
276-
277283
=head1 DESCRIPTION
278284
279285
C<Data::FormValidator::Constraints::MethodsFactory> provides a variety of

0 commit comments

Comments
 (0)