FIX: print error message causes error
authorKen-ichi Mito <mitty@mitty.jp>
Fri, 12 Jul 2013 14:37:54 +0000 (23:37 +0900)
committerKen-ichi Mito <mitty@mitty.jp>
Fri, 12 Jul 2013 14:37:54 +0000 (23:37 +0900)
 * Net::Twitter::Lite::Error->twitter_error->{errors} is sometimes simple string

Dev/twitter/twitterbot.pl

index 4606d95..a4ead6b 100755 (executable)
@@ -302,7 +302,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";