On 2001.07.04 06:19 Kevin Hancock wrote:
> I am having trouble with CGI.pm. The module seems great and does a lot of
> cool stuff but this seems silly.
>
> I have a script that needs to be called several times and collects
> different
> data each time.
>
> So I figgured I could save the state and restore the parameters each time
> the script is run. All the documentation suggests this is possible.
>
> The saving the parameters is great but how do you get them back?
I think what you are asking goes quite agains the Object Oriented modell:
You want to mix the values of two separate objects.
So probably you'll need to create two separate object (one read from the
file and the other one which you hve just received from the browser)
and you'll have to combine the values manually
You have received the data from the first page and saved it to
the test.out file.
On the second access yo read the data from the test.out file:
> # reopen for reading
> open (IN,"test.out") || die;
> my $q = new CGI(IN);
> close IN;
here you have $q->param('junk') filled in with the values from the
test.out file.
my $w = new CGI;
foreach $p ($w->param) {
$q->param($p)=$w->param($w);
}
now you can save the object $q to the file (make sure you overwrite the
earlier data).
Of course you have to be think how you handle duplicate fields
when in two forms you have the same field. Which value will overwrite
the whih one ?
regards
-- Gabor
www.tracert.com