append a session's history on shell exit and unlimited history list
[lab.git] / Dev / twitter / twitterbot.pl
index f33837b..1aa5bbd 100755 (executable)
@@ -179,6 +179,7 @@ sub login {
         consumer_key    => $conf->{consumer_key},
         consumer_secret => $conf->{consumer_secret},
         legacy_lists_api => 0,
+        ssl             => 1,
     );
     
     $bot->access_token($conf->{access_token});
@@ -220,8 +221,8 @@ sub or_search {
             );
         }
         VERBOSE and warn Dumper($res);
-        if ($res->{results}) {
-            foreach my $tweet (@{$res->{results}}) {
+        if ($res->{statuses}) {
+            foreach my $tweet (@{$res->{statuses}}) {
                 my $res = $bot->show_status($tweet->{id});
                 VERBOSE and warn Dumper($res);
                 
@@ -302,7 +303,7 @@ sub evalrescue {
         warn $@->error;
         if ($@->twitter_error) {
             my $twitter_error = $@->twitter_error;
-            if (defined $twitter_error->{errors}) {
+            if (defined $twitter_error->{errors} && ref($twitter_error->{errors})) {
                 foreach my $error (@{$twitter_error->{errors}}) {
                     warn "code => "   , $error->{code}, "\n";
                     warn "message => ", $error->{message}, "\n";