Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: PUT a Multipart request in PERL

by Anonymous Monk
on Apr 02, 2015 at 08:44 UTC ( #1122237=note: print w/replies, xml ) Need Help??

in reply to PUT a Multipart request in PERL

I am using following code: typos and typos and typos and typos and typos and typos and typos

Hi xpert, see perlintro/perlquote and fix your quotes

It is generating following error:

Even if you fix the quotes the code still won't compile

If you fix that, says its like and not like meaning you have create a POST request and then alter it

Anyway, its more convenient to use WWW::Mechanize even when you have to HTTP::Request::Common manually :)

Replies are listed 'Best First'.
Re^2: PUT a Multipart request in PERL
by xpert (Initiate) on Apr 06, 2015 at 18:36 UTC

    Hi Monk, Here is my code:

    use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $xmlfile = [ 'C:\\temp\\Test_1.xml', 'Test_1.xml', 'Content-type' => 'text/xml' ]; my $docfile = [ 'C:\\temp\\Test_1.doc', 'Test_1.doc', 'Content-type' => 'application/msword' ]; my $signedurl = ''; my $myresponse = $mech->put($signedurl, 'Content' => [ 'file1' => +$xmlfile, 'file2' => $docfile ] );

    It is producing following ERROR:

    Not a SCALAR reference at C:/Dwimperl/perl/vendor/lib/HTTP/ +line 156. at C:/Dwimperl/perl/vendor/lib/HTTP/ line 156 HTTP::Message::add_content('HTTP::Request=HASH(0x32e2d9c)', 'ARRAY(0x3 +2113f4)') called at C:/Dwimperl/perl/vendor/lib/HTTP/Request/Common.p +m line 108 HTTP::Request::Common::_simple_req(undef, undef) called at C:/Dwimperl +/perl/vendor/lib/HTTP/Request/ line 22 HTTP::Request::Common::PUT('', 'Content', 'ARRAY +(0x32113f4)') called at C:/Dwimperl/perl/site/lib/WWW/ line 439 WWW::Mechanize::_SUPER_put('WWW::Mechanize=HASH(0x30a72bc)', '', 'Content', 'ARRAY(0x32113f4)') called at C:/Dwimperl/perl/site/lib/WWW/ line 430 WWW::Mechanize::put('WWW::Mechanize=HASH(0x30a72bc)', 'http://someURL. +com/...', 'Content', 'ARRAY(0x32113f4)') called at line 110 Utils::Words_multipart('Utils=HASH(0x30a49b4)') called at multipart_1. +pm line 138 Press any key to continue . . .

    Please guide

      Please guide

      I already did, which part was unclear?

        I am getting Error: Not a SCALAR reference at C:/Dwimperl/perl/vendor/lib/HTTP/ line 156.

        I am using WWW::Mechanize as mentioned by you, even then same error. Please, guide how to get rid of this error.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2020-12-02 07:44 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (35 votes). Check out past polls.