http://www.perlmonks.org?node_id=611139


in reply to Data::FormValidator, equivalent to "require_some_regexp"?

I think the mistake you are making is assuming that the DFV profile has to be hard-coded or that the DFV profile has to do all the work.

Dynamically generate a DFV profile. It is only a hash structure so there is no reason that this will not work.

use CGI; my $q = CGI->new(); my @fields = $q->param(); my @foo_fields; for my $field (@fields) { push @foo_fields, $field if $field qr{^foo_}xm; } my $profile = {}; $profile->{require_some} => { foo_fields => [1, @foo_fields ] };