Here's a a fix to make it work for both single and list context inputs, i.e. radio and checkbox elements. This has not been tested for file upload elements.
# Traverse the keys foreachmy$p(@params){ # Get all values in list context my@v=$query->param($p); my@y; # for each of these elements, clean and detag, # Then push onto new value list foreachmy$v(@v){ $v=clean(detag($v)); push(@y, $v); } # Update query with reference to new value list $query->param(-name=>$p, -value=>\@y); }
# Traverse the keys
foreach my $p (@params){
# Get all values in list context
my @v=$query->param($p);
my @y;
# for each of these elements, clean and detag,
# Then push onto new value list
foreach my $v (@v){
$v=clean(detag($v));
push(@y, $v);
}
# Update query with reference to new value list
$query->param(-name=>$p, -value=>\@y);
}