C_T has asked for the wisdom of the Perl Monks concerning the following question:
I'm curious if there is a way to pass a hash as parameters in a perl CGI script.
For example, I tried this, which doesn't seem to work:
This just passes a string that says "HASH(0x3jshdf29)" or somesuch.$test_hash{$switch_name}{'port_desc'} = 'Whatever'; $test_hash{$switch_name}{'speed'} = 'auto'; $test_hash{$switch_name}{'duplex'} = 'auto'; $test_hash{$switch_name}{'reserve_status'} = 'active'; $test_hash{$switch_name}{'port_vlan'} = '999'; $test_hash_ref = \%test_hash; print qq~<input type=hidden name="test_ref" value="$test_hash_ref">\ +n~;
Beyond breaking the hash down into its component key=>value pairs and passing each individually, then reassembling them into a hash again, is there a more elegant way to pass a data structure to a CGI form? I'd like to pass a REALLY big data structure, and the idea of doing it as 400 key=>value pairs really doesn't appeal.
Thanks for any info.
CT
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pass a hash as parameter to a CGI?
by Random_Walk (Prior) on Sep 16, 2004 at 17:29 UTC | |
by C_T (Scribe) on Sep 16, 2004 at 18:22 UTC | |
|
Re: Pass a hash as parameter to a CGI?
by ikegami (Patriarch) on Sep 16, 2004 at 17:31 UTC | |
by C_T (Scribe) on Sep 16, 2004 at 18:05 UTC | |
by ikegami (Patriarch) on Sep 16, 2004 at 18:20 UTC | |
by C_T (Scribe) on Sep 16, 2004 at 18:13 UTC | |
|
Please remember to be safe.
by tmoertel (Chaplain) on Sep 16, 2004 at 19:13 UTC |