Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Sending XML data is simple right?

by erroneousBollock (Curate)
on Nov 15, 2007 at 17:45 UTC ( [id://651040]=note: print w/replies, xml ) Need Help??


in reply to Sending XML data is simple right?

Try this:

my $response = $browser->post($url, Content => join('', @data));

... and then read up on the fat comma (=>) operator in perlop.

What you're doing is equivalent to:

my $response = $browser->post($url, Content => $data[0], $data[1] => $data[2], $data[3] => $data[4], ... );

... which is not expected by the post method.

Update: Oops, thanks Jenda :-/

-David

Replies are listed 'Best First'.
Re^2: Sending XML data is simple right?
by Jenda (Abbot) on Nov 15, 2007 at 18:05 UTC

    This would cause the sent data to look like this

    <?xml version="1.0"?> <root> <othertag>foo</othertag> </root>
    The elements of the @data array do contain the newlines already.

    If you want to merge the array into a single string you should use join( '', @data)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://651040]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found