in reply to HTML Form Data to XML file

Take a look at XML::Smart, is the faster way to start working with XML and CGI. Here's an example of use:
use XML::Smart ; sub process_form { my (%form , $buffer) ; if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'}) ; } else { $buffer = $ENV{'QUERY_STRING'} } my @name_value_pairs = split('&',$buffer) ; foreach my $name_value_pair (@name_value_pairs) { my ($name,$value) = split('=',$name_value_pair); $value =~ tr/+/ /; $value =~ s/%([0-9A-Fa-f]{2})/pack("C",hex($1))/eg; $form{$name} = $value; } return %form ; } my %form = process_form() ; my $xml = XML::Smart->new() ; $xml->{form} = \%form ; print $xml->data ;

Replies are listed 'Best First'.
Re: Re: HTML Form Data to XML file
by mirod (Canon) on Mar 03, 2004 at 18:34 UTC

    Please, please, please! Why would you write your own CGI parser when CGI or CGI::Lite do it better and safer?

    Or did I just feed the troll? ;--(