use strict; use warnings; use base 'CGI::Application'; use CGI::FormBuilder; main->new->run; # emulated for example purpose sub setup { my $self = shift; $self->start_mode('create_form'); $self->run_modes([qw(create_form list)]); } sub create_form { my $self = shift; my @fields = qw(name age); my $cgi = $self->query; my $form = CGI::FormBuilder->new( fields => \@fields, params => $cgi, keepextras => 1, ); # or, instead of using the keepextras option # you call the method with the same name # $form->keepextras(1); # push onto the CGI parameter stack $cgi->param($self->mode_param => $self->get_current_runmode); # UPDATE: change hardcoded "rm" to method call print $form->submitted && $form->validated ? $form->confirm : $form->render; } #### $ perl cfb.pl Content-Type: text/html; charset=ISO-8859-1
Name
Age