Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-30-2004, 10:11 AM   #1
LQ Newbie
Registered: Nov 2003
Posts: 7

Rep: Reputation: 0
Question passing anonymous hash in CGI hidden field

i am trying to pass an anonymous hash to another cgi via a CGI hidden field. It doesn't seem to be working, and I was wondering if somebody could help me figure out what I'm doing wrong.

Here's the code:

debug("Before hidden pass Globals = ", Dumper($Gvars));
print $cgi->hidden( -name=>'Globals', -value=>%{$Gvars});

the code in the results.cgi is:
my $a={};
$a = $Cgi->param('Globals');
print Dumper($a);

the debug right before the hidden call shows that my hash is populated with everything I want in it, but when I dump $a on results.cgi, it just gives me the first key in the $Gvars hash.

any ideas? sorry if this isn't explained well.

Old 01-30-2004, 11:19 AM   #2
LQ Newbie
Registered: Nov 2003
Posts: 7

Original Poster
Rep: Reputation: 0
Lightbulb the answer

in case anyone cares, the solution I came up with is as follows.

First, you can't pass complex data types to hidden. It must be a string. Going to CPAN yielded FreezeThaw which allows me to very quickly flatten my hash into a string, pass it, and than "thaw" it back into a hash on the other side. Sweet!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing hash of hashes as a parameter (Perl) rose_bud4201 Programming 8 04-21-2005 07:18 PM
passing passing variable in Java as reference djgerbavore Programming 3 11-10-2004 02:18 PM
files uploaded to anonymous ftp not readable by anonymous TheOneAndOnlySM Linux - Software 2 11-04-2004 07:42 AM
Exec CGI within a form field newuser455 General 0 09-12-2004 01:50 PM rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:57 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration