I think what you want is to pass to your content method an array reference, not a string. In your first example,
$req->content("xmlmsg=$xmlmsg"); should be
$req->content([ xmlmsg => $xmlmsg ]);.
The pertinent part of the man page I was referring to is:
The POST method also supports the multipart/form-data
content used for Form-based File Upload as specified in
RFC 1867. You trigger this content format by specifying
a content type of 'form-data' as one of the request
headers. If one of the values in the $form_ref is an
array reference, then it is treated as a file part
specification with the following interpretation:
[ $file, $filename, Header => Value... ]
The first value in the array ($file) is the name of a
file to open. This file will be read and its content
placed in the request. The routine will croak if the
file can't be opened. Use an undef as $file value if
you want to specify the content directly. The $filename
is the filename to report in the request. If this value
is undefined, then the basename of the $file will be
used. You can specify an empty string as $filename if
you don't want any filename in the request.
Note that I have not tested this code, but I hope it points you in the right direction.
Cheers,
Shendal
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.