]> Dogcows Code - chaz/p5-CGI-Ex/blob - samples/devel/dprof_validation.d
5b02305a23e77a66418ea60796280cb19a9a6aa7
[chaz/p5-CGI-Ex] / samples / devel / dprof_validation.d
1 # -*-perl-*-
2 # run with perl -d:DProf $0
3
4 use CGI::Ex::Validate;
5
6 my $form = {
7 username => "++foobar++",
8 password => "123",
9 password2 => "1234",
10 };
11
12 my $val_hash_ce = {
13 username => {
14 required => 1,
15 match => 'm/^\w+$/',
16 match_error => '$name may only contain letters and numbers',
17 untaint => 1,
18 },
19 password => {
20 required => 1,
21 min_len => 6,
22 max_len => 30,
23 match => 'm/^[ -~]+$/',
24 untaint => 1,
25 },
26 password2 => {
27 validate_if => 'password',
28 equals => 'password',
29 },
30 email => {
31 required => 1,
32 match => 'm/^[\w\.\-]+\@[\w\.\-]+$/',
33 untaint => 1,
34 },
35 };
36
37
38 for (1 .. 10_000) {
39 my $err_obj = CGI::Ex::Validate->validate($form, $val_hash_ce);
40 # my $err_obj = CGI::Ex::Validate->validate($form, $val_hash_ce)->as_hash;
41 }
This page took 0.03 seconds and 3 git commands to generate.