use CGI; use HTML::Template; use HTML::FillInForm; use CGI::Carp qw(carpout); use Data::Dumper; our $q = CGI->new; my $TData = $q->Vars; # return value pairs from form carp "Form values:", Dumper($TData) if $debug > 1; if ($TData->{'Save'} || $TData->{'Submit'}) { if (-e $savefile) { open (SFILE, $savefile) || die "cant open $savefile for read\n"; $old = new CGI(SFILE); close SFILE; } } my $t = HTML::Template->new(filename => $tmplfile, option => 'loop_context_vars'); print $q->header; print $q->start_html(); $t->param(ROWS => \@Data); my $html = $t->output; my $fhtml = HTML::FillInForm->fill(\$html, $q); print $fhtml, "\n"; print $q->end_html; my $tmp = $q->Vars; # see if this forces the save to work first time through!! open(SAVEFILE, ">$savefile") || die "$pgm: cant open $savefile for write\n"; $q->save(\*SAVEFILE); print SAVEFILE "$pgm: end of current state at $today\n"; close (SAVEFILE);