[Catalyst] parameter validation
Caroline Johnston
johnston at biochem.ucl.ac.uk
Wed Jul 2 23:08:46 BST 2008
Hi,
This isn't strictly a catalyst question, but it arose from a previous
thread,
http://lists.scsys.co.uk/pipermail/catalyst/2007-December/016329.html, on
parameter validation and the problems of code like
my $user = $rs->create({
is_admin => 0,
username => $c->req->param('username'),
});
I'm using Data::FormValidator. If I have a DFV constraint on fields that
shouldn't be multi-valued, something like:
sub is_single{
my $c = shift;
return sub{
my $dfv = shift;
$dfv->name_this('is_single');
my $field = $dfv->get_current_constraint_field;
my $data = $dfv->get_filtered_data;
my $test = $data->{$field};
return ref $test ? 0:1;
}
}
should that allow me to use validated parameters in hashes with impunity
or am I missing the point of the problem?
cheers,
Cass
More information about the Catalyst
mailing list