[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] CGI restore_parameters()



Hi Lincoln --

Does restore_parameters not work the way I think it should? save() is saving a state file fine, and new($fh) will read that state file fine, but I can't seem to get restore_parameters to do anything...

perl v5.8.3 built for i686-linux
CGI v3.10
Linux razorbill 2.4.21-243-default #1 Thu Aug 12 15:22:14 UTC 2004 i686 i686 i386 GNU/Linux

Thanks,

j

----------------------- 
#!/usr/bin/perl

use strict;
use CGI;
use FileHandle;

my $q = CGI->new();
my $fh = FileHandle->new(">/tmp/q.param");
$q->param("name", "Jay");
$q->save($fh);
$fh->close;

# Ok, /tmp/q.param is has name in it. Worked fine. 
# Let's try to restore_parameters() it...

$fh = FileHandle->new("/tmp/q.param");
my $q = CGI->new();
$q->restore_parameters($fh) or die;
print "name is ", $q->param("name"), "\n";

# No good. name is empty. 

$fh = FileHandle->new("/tmp/q.param");
my $q = CGI->new($fh);
print "name is ", $q->param("name"), "\n";

# That worked fine. name is set. 
-----------------------