dorko has asked for the wisdom of the Perl Monks concerning the following question:


I'm looking to turn a Perl data structure into a CGI query string.

There are several modules that turn query strings into data structures (eg CGI::Struct and CGI::State), but I need to do the opposite.

I've got something like this:

%hash = ( 'name' => 'test name', 'file_ids' => [ 1, 2 ], 'sub' => { 'name' => 'foo', 'message' => 'bar' }, );

And I want to turn it into something like this:


Even "data structure ==> JSON ==> query string" would be ok too.

I'm not finding any modules that do what I'm looking for. Does something like this exist?



-- Yeah, I'm a Delt.