Hi All, i am new to perl and i have problem in creating http request through perl, i am devloping one application for my client using quickbook api and trying to add feature which will upload attachment for invoice using api code

in api docs that to upload attachment we need to post http request body as follows

Content-Type: multipart/form-data; boundary=WUlKV_AtI1-uGU0dtt-ebGl0zL +9pZudYnaI8t2g --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_metadata_0" Content-Type: application/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Attachable xmlns="http://schema.intuit.com/finance/v3"> <FileName>sammie_and_bubbles.jpg</FileName> <Size>278055</Size> <ContentType>image/jpeg</ContentType> <Category>Contact Photo</Category> <Lat>37.120394837</Lat> <Long>-37.12398043298</Long> <PlaceName>Fake Place</PlaceName> <Note>This is a picture of Yujung's dog eating bubbles</Note> <Tag>Sammie</Tag> </Attachable> --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_content_0"; filename="sammi +e_and_bubbles.JPG" Content-Type: image/jpeg Content-Transfer-Encoding: binary ...binary data ... --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_content_1"; filename="hello +.txt" Content-Type: text/plain Content-Transfer-Encoding: binary ...binary data ... --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_metadata_2" Content-Type: application/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Attachable xmlns="http://schema.intuit.com/finance/v3"> <FileName>intuit.png</FileName> <Size>7169</Size> <ContentType>image/png</ContentType> <Category>Image</Category> <Note>This file is Intuit logo from insight</Note> <Tag>intuit_logo</Tag> </Attachable> --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_content_2"; filename="intui +t.png" Content-Type: image/png Content-Transfer-Encoding: binary ...binary data... --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g--
how will be the code for perl to post same body i tried to post it as follows
my $r = $ua->post( $url, Content_Type => 'form-data', Content => [ file_metadata_0 => $xml, file_content_0 => $filename ] ); my $res_xml = $r->decoded_content;
here i have provided code for just one file upload with xml post which is first file sammie_and_bubbles.JPG but this approach if failing and how can i post ...binary data... of the file from request , please help

In reply to complex http request by dhiraj121083

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.