X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=samples%2Fdevel%2Fdprof_validation.d;fp=samples%2Fdevel%2Fdprof_validation.d;h=5b02305a23e77a66418ea60796280cb19a9a6aa7;hb=4eee158dce82376f2f37de29d91c53f60a24aebe;hp=0000000000000000000000000000000000000000;hpb=85070b46d0a93ddbeef07341421adb8389a55418;p=chaz%2Fp5-CGI-Ex diff --git a/samples/devel/dprof_validation.d b/samples/devel/dprof_validation.d new file mode 100644 index 0000000..5b02305 --- /dev/null +++ b/samples/devel/dprof_validation.d @@ -0,0 +1,41 @@ +# -*-perl-*- +# run with perl -d:DProf $0 + +use CGI::Ex::Validate; + +my $form = { + username => "++foobar++", + password => "123", + password2 => "1234", +}; + +my $val_hash_ce = { + username => { + required => 1, + match => 'm/^\w+$/', + match_error => '$name may only contain letters and numbers', + untaint => 1, + }, + password => { + required => 1, + min_len => 6, + max_len => 30, + match => 'm/^[ -~]+$/', + untaint => 1, + }, + password2 => { + validate_if => 'password', + equals => 'password', + }, + email => { + required => 1, + match => 'm/^[\w\.\-]+\@[\w\.\-]+$/', + untaint => 1, + }, +}; + + +for (1 .. 10_000) { + my $err_obj = CGI::Ex::Validate->validate($form, $val_hash_ce); +# my $err_obj = CGI::Ex::Validate->validate($form, $val_hash_ce)->as_hash; +}