- Timestamp:
- Apr 6, 2009, 9:16:09 PM (16 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- b25b5a4
- Parents:
- 4ea78a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/BarnOwl/Module/Twitter.pm
r4ea78a8 rf0550c5 22 22 use HTML::Entities; 23 23 24 my$twitter;24 our $twitter; 25 25 my $user = BarnOwl::zephyr_getsender(); 26 26 my ($class) = ($user =~ /(^[^@]+)/); … … 145 145 sub twitter_error { 146 146 my $ratelimit = $twitter->rate_limit_status; 147 unless(defined($ratelimit) ) {147 unless(defined($ratelimit) && ref($ratelimit) eq 'HASH') { 148 148 # Twitter's just sucking, sleep for 5 minutes 149 149 $last_direct_poll = $last_poll = time + 60*5; … … 151 151 return; 152 152 } 153 if($ratelimit->{remaining_hits} <= 0) { 153 if(exists($ratelimit->{remaining_hits}) 154 && $ratelimit->{remaining_hits} <= 0) { 154 155 $last_direct_poll = $last_poll = $ratelimit->{reset_time_in_seconds}; 155 156 die("Twitter: ratelimited until " . $ratelimit->{reset_time} . "\n"); 157 } elsif(exists($ratelimit->{error})) { 158 die("Twitter: ". $ratelimit->{error} . "\n"); 159 $last_direct_poll = $last_poll = time + 60*20; 156 160 } 157 161 } … … 163 167 164 168 my $timeline = $twitter->friends_timeline( { since_id => $last_id } ); 165 unless(defined($timeline) && ref($timeline) ) {169 unless(defined($timeline) && ref($timeline) eq 'ARRAY') { 166 170 twitter_error(); 167 171 return; … … 195 199 196 200 my $direct = $twitter->direct_messages( { since_id => $last_direct } ); 197 unless(defined($direct) && ref($direct) ) {201 unless(defined($direct) && ref($direct) eq 'ARRAY') { 198 202 twitter_error(); 199 203 return;
Note: See TracChangeset
for help on using the changeset viewer.