This is how I do it - it's part of my regular CGI::Application framework. But you can also get Vars() from CGI.pm or CGI::Simple. Other stuff is to skip some or all fields (say when creating a CMS and you don't want it to mess up any HTML code inside).
sub form {
my $self = shift;
my %params = @_;
my $skip = array_to_hash($params{'skip_fields'}); # Array/ArrayRef
my $q = $self->query();
my %vars = $q->Vars();
unless($params{dont_encode_fields}){
use HTML::Entities;
foreach(keys %vars){
next if $skip->{$_}; # Don't encode if it's in skip list
$vars{$_} = HTML::Entities::encode_entities($vars{$_}, '<>
+&"');
}
}
return \%vars;
}
PS. Latter I found out about grep trick to check if variable is in the array - should change this ...
Have you tried freelancing? Check out
Scriptlance - I work there. For more info about Scriptlance and freelancing in general check out
my home node.