Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-Twitter CPAN distribution.

Report information
The Basics
Id: 54422
Status: resolved
Priority: 0/
Queue: Net-Twitter

People
Owner: MMIMS [...] cpan.org
Requestors: daniel [...] lbers.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.11003
Fixed in: (no value)



Subject: update_profile_image doesn't work
update_profile_image() parameters according to the POD are interpreted as ArrayRef, but passing an ArrayRef leads to the error: arg 0 must not be a reference Instead it expects a single parameter $image, containing the binary image data. Passing that, no error occurs, but the profile image isn't actually updated.
Indeed a bug. Here's a simple workaround: $nt->update_profile_image({ image => [ $filename ] }); Thanks for the report. -Marc
On Mon Feb 08 16:44:12 2010, http://id.bandsal.at/al/ wrote: Show quoted text
> Instead it expects a single parameter $image, containing the binary > image data. Passing that, no error occurs, but the profile image isn't > actually updated.
For clarification, no, it does not expect the binary image data. All Net::Twitter methods accept a hashref of named parameters. When a method has only one required parameter, as a convenience, the value can be passed as the first parameter to the method. That's what's broken in this case---the convenient, short form isn't recognizing the value as it should. So, falling back to the hashref of named parameters works. update_profile_image has a single required parameter: image. So it can be called with: $nt->update_profile_image({ image => $image_value }) where, $image value is an arrayref, as described in the POD. You can pass the binary image data: $nt->update({ image = > [ undef, $filename, # the name Twitter will use for the image Content_Type => $mime_type, # e.g, 'image/jpeg' Content => $raw_image_data, ]});
Subject: Re: [rt.cpan.org #54422] update_profile_image doesn't work
Date: Tue, 09 Feb 2010 21:52:55 +0100
To: bug-Net-Twitter [...] rt.cpan.org
From: Daniel Albers <daniel [...] lbers.com>
On Tue, 09 Feb 2010 Marc Mims via RT <bug-Net-Twitter@rt.cpan.org> wrote: Show quoted text
> For clarification, no, it does not expect the binary image data. > > All Net::Twitter methods accept a hashref of named parameters. When a > method has only one required parameter, as a convenience, the value can > be passed as the first parameter to the method.
That was insightful, thanks a lot. I was able to get rid of this kludge now ;-) - #FIXME arg 0 must not be a reference at ./twimghue.pl line 48 - #$nt->update_profile_image([ undef, 'bernard.gif', Content_Type => 'image/gif', Content => $image->ImageToBlob() ]); - my ($fh, $imgpath) = tempfile(undef, SUFFIX => '.gif'); - $image->Write(filename => $imgpath); - $fh->close(); - $nt->update_profile_image({ image => [ $imgpath ] }); + $nt->update_profile_image({ image => [ undef, 'bernard.gif', Content_Type => 'image/gif', Content => $image->ImageToBlob() ]});
Fixed in 3.11005, just shipped to CPAN.