in reply to XML from CGI parameters
I think the problem is that the hashref returned from CGI::Vars() is a tied hashref, which XMLout doesn't seem to like. Making a copy of it as shown below seems to 'avoid' the problem.
#! perl -w use strict; use CGI; use XML::Simple; my $cgi= new CGI; my $xs = new XML::Simple(); my $elements = $cgi->Vars(); my %copy = %$elements; my $xml = $xs->XMLout(\%copy, rootname => 'source'); print $xml; __DATA__ #output C:\test>184342 "test=1&fred=bill&something=somethingelse" '<source fred="bill" something="somethingelse" test="1" />
Update: Removed redundant use of Data::Dumper.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML from CGI parameters
by Aristotle (Chancellor) on Jul 23, 2002 at 13:38 UTC |