Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: CGI form results to XML

by Your Mother (Chancellor)
on Feb 16, 2013 at 22:26 UTC ( #1019083=note: print w/replies, xml ) Need Help??

in reply to CGI form results to XML

use CGI "param"; my @birthdays = param("birthday");

CGI. It really is that easy. Donít roll your own. You have to be an expert in all the relevant RFCs as well as browser quirks to do it well and any expert wouldnít do it because itís already done.

Also, do *not* write your own XML. Itís similarly much more difficult to do right than is obvious. XML::LibXML or XML::Simple are typical choices and the latter can be easy if you know its limitations v your actual task.

Replies are listed 'Best First'.
Re^2: CGI form results to XML
by 7stud (Deacon) on Feb 17, 2013 at 01:29 UTC
    ++ for being able to decipher that post.

      7stud I have a question

      where do I put the code you suggested if I want these repeat HTML name and value fields (Birthdays) and all the rest of the name and value fields in the form

      #! /usr/bin/perl use CGI "param"; print "Content-type: text/html\n\n"; print "&ltresponse&gt<BR/>"; foreach my $name ( param() ) { my $values = param ($name); print "&lt$name&gt<I>$values&lt/$name&gt</I><BR>"; } print "&lt/response&gt<BR/>";
      my @birthdays = param ("birthday");

        Thanks for the links and the heads up

      Ha Ha

      I knew you were going to say that. I could not find the button to upload the code

      I knew you were going to say that

Re^2: CGI form results to XML
by spencerr1 (Novice) on Feb 17, 2013 at 00:21 UTC

    Thank You for your reply. Yes I have good book Perl and XML and am working through it, there are examples of XML::Simple and XMLLib.

    Thanks again

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019083]
[ambrus]: was this bug: https://rt.cpan. org/Public/Bug/ Display.html?id= 59814
[Corion]: ambrus: Oh - that one would be much harder to automate... The SYNOPSIS section should mostly be a runnable program IMO, but I write only small snippets in my documentation for single functions/methods, and creating the appropriate environment for ...
[Corion]: ... those in an automated fashion seems somewhat hard to me. Although it should do wonders for the test coverage ;)
[haukex]: Corion: I once wrote an automated thingy for that here
[haukex]: here's the code that uses it
[Corion]: haukex: Hmm - maybe I can reuse that. I see that it uses Pod::Parser, which I think was one of the more fragile parsers. But if I'm statically (re)generating the tests instead of doing that "live" on the client/tester machines, that's a much smaller...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2017-02-27 12:18 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (385 votes). Check out past polls.