My twitterbot is back on line after a long vacation (ok so twitter tweaked their API and for a while they were ignoring my posts) It turns out I needed to add “apiurl => ‘http://api.twitter.com/1.1’,” to my connection information and all was back to working again.
The issue was that Net::Twitter::Lite was using the old twitter API that has been retired. Instead of posting to your twitter account the error 410: Gone was all that was returned.
Here is my updated script (of course you need to add your own keys and tokens)
#!/usr/bin/perl use Net::Twitter::Lite; my $nt=Net::Twitter::Lite->new( legacy_lists_api => 1, consumer_key => "KEY", consumer_secret => "SECRET", access_token => "TOKEN", access_token_secret => "SECRET", apiurl => 'http://api.twitter.com/1.1', ); $quote=`/usr/games/fortune`; $quote=substr($quote,0,139); $quote =~ s/\s+$//; $nt->update($quote);
What is fortune you may ask? As Wikipedia says “Fortune is a simple program that displays a pseudorandom message from a database of quotations that first appeared in Version 7 Unix.” An example of this is “Beware of a dark-haired man with a loud tie.” The other magic glue that is used here is Perl (a useful scripting language), Net::Twitter::Lite (a light weight twitter api because I am lazy) and Crontab to (periodically run the script and post my wisdom to twitter). Thanks also to the perl monks for their wisdom in how to solve the error message 410:Gone