Thiago
Thiago

Reputation: 724

Response Codes Net::Twitter:Stream

I'm new in this forum and I'm having some problems with the perl library Net::Twitter:Stream. I'm following the example in this link Net::Twitter:Stream.

But it is missing the part when I get a bad response code(another than 200) and I have to stop my algorithm. So, what can I do in this case? I'm afraid to use it so much and enter into the twitter black list...

I'm basing in this code below:

use Net::Twitter::Stream;
Net::Twitter::Stream->new ( user => $username, pass => $password,
                          callback => \&got_tweet,
                          track => 'perl,tinychat,emacs',
                          follow => '27712481,14252288,972651' );
sub got_tweet {
     my ( $tweet, $json ) = @_;   # a hash containing the tweet
                                  # and the original json
     print "By: $tweet->{user}{screen_name}\n";
     print "Message: $tweet->{text}\n";
}

Upvotes: 1

Views: 197

Answers (1)

charlesbridge
charlesbridge

Reputation: 1212

I think you'll want to add connection_closed_cb=>\&bad_response, see this stackoverflow questions last answer. I'm not sure why that ability isn't documented but it is available if you check the source code. I also couldn't find that module in CPAN.

Upvotes: 1

Related Questions