Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: MediaWiki::API->upload() problem

by spekulum (Initiate)
on Sep 27, 2011 at 20:10 UTC ( #928170=note: print w/ replies, xml ) Need Help??


in reply to Re^3: MediaWiki::API->upload() problem
in thread MediaWiki::API->upload() problem

Any decode functions don't work.

$response return code of data in image format, i. e. png, jpg

Some examples:

$response = $response->content() if($response->is_success()); die Dumper($response);
$ perl test.pl $VAR1 = '&#9618;PNG IHD&#9618;6n&#9618;sRGB&#9618;&#9618;&#9618;gAMA&#9618;&#9618; &#9618;a cHRMz&&#9618;&#9618;&#9618;&#9618;&#9618; +u0&#9618;`:&#9618;p&#9618;&#9618;Q<!IDATWc&#9618; &#9618;*1&#9618;&#9618;Ig&#9618; &#9618;&#9618;&#9618;+(&#9618;&#9618;K&#9618;&&#1432;IEND&#9618;B`&#96 +18;';
$response = $response->decoded_content() if($response->is_success()); die Dumper($response);
$ perl test.pl $VAR1 = '&#9618;PNG IHD&#9618;6n&#9618;sRGB&#9618;&#9618;&#9618;gAMA&#9618;&#9618; &#9618;a cHRMz&&#9618;&#9618;&#9618;&#9618;&#9618; +u0&#9618;`:&#9618;p&#9618;&#9618;Q<!IDATWc&#9618; &#9618;*1&#9618;&#9618;Ig&#9618; &#9618;&#9618;&#9618;+(&#9618;&#9618;K&#9618;&&#1432;IEND&#9618;B`&#96 +18;';
$response = $response->content() if($response->is_success()); $response = utf8::downgrade($response); die Dumper($response);
$ perl test.pl $VAR1 = 1;
Probably, needs to use some specific libs for work with it?


Comment on Re^4: MediaWiki::API->upload() problem
Select or Download Code
Re^5: MediaWiki::API->upload() problem
by Anonymous Monk on Sep 27, 2011 at 20:51 UTC

    I have no idea what you're getting at

    When you get HTTP::Message content must be bytes it means you must only give it bytes not text, in other words, don't use decoded_content

    If you're saying that using ->content you still get this error(content must be bytes), that means $response isn't the culptrit, then you need to identify which parameter is triggering it by process of elimination, and make some bytes (encode)

    perlunitut: Unicode in Perl#encoding

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (14)
As of 2014-09-16 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (40 votes), past polls