tags:

views:

44

answers:

1

We have been using Perl's Net:Twitter CPAN module (version 3.12) and basic authentication (not OAuth) for almost a year now to syndicate updates from our site to our Twitter account. We just migrated to a new server last week and since the move our updates to Twitter have stopped and the following error is being reported whenever we try to post an update:

HTTP::Message content not bytes at /usr/lib/perl5/site_perl/5.8.8/HTTP/Request/Common.pm line 90

Here is the code we're using the update our Twitter account:

use Net::Twitter;
my $twitter = Net::Twitter->new(
    traits   => [qw/API::REST/],
    username => $username,
    password => $password,
    source => 'twitterfeed'
);  

my $result = $twitter->update($status);

I have no idea what the issue is and was hoping that someone else has run into this issue and can provide a quick solution. Thanks in advance for your help!

A: 

Most complaints about that error seem to be solved by updating libwww-perl and SOAP::Lite. When Perl made the switch to representing internal strings as UTF-8, it took awhile for the modules to catch up. It was so easy to assume that all strings were octets, so most modules didn't bother with encodings and the like. Most of the main modules should be fixed by now.

Try googling for "HTTP::Message content not bytes" to see how other people solved it. In general, googling the error message often turns up lots of helpful discussions. :)

brian d foy
I think he really wants to utf8::encode $status. You can't have wide characters in HTTP messages, but you can have them in perl scalars. Hence the error.
jrockway
I thought that the latest updates were supposed to do that for you.
brian d foy
@Brian - it does. I went ahead and upgrade the module which seems to have resolved the problem. I did search Google before posting but thought that there may be some underlying issue that I needed to get at over and above the module handing things incorrectly which doesn't seem to be the case. Thanks for your help!
Russell C.