Changeset a5b6bf1 in lab.git for Dev/twitter/twitterbot.pl


Ignore:
Timestamp:
Jun 21, 2013 3:38:04 PM (11 years ago)
Author:
Ken-ichi Mito <mitty@…>
Branches:
master
Children:
e960958
Parents:
fd6dbd0
Message:

fix evalrescue fuction

  • dereference Net::Twitter::Lite::Error->twitter_error object correctly
  • use Data::Dumper for unknown structure
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/twitter/twitterbot.pl

    r43d739e ra5b6bf1  
    302302        warn $@->error; 
    303303        if ($@->twitter_error) { 
    304             my %twitter_error = %{$@->twitter_error}; 
    305             map { 
    306                 $twitter_error{"$_ => "} = $twitter_error{$_} . "\n"; 
    307                 delete $twitter_error{$_} 
    308             } keys %twitter_error; 
    309             warn join("", %twitter_error); 
     304            my $twitter_error = $@->twitter_error; 
     305            if (defined $twitter_error->{errors}) { 
     306                foreach my $error (@{$twitter_error->{errors}}) { 
     307                    warn "code => "   , $error->{code}, "\n"; 
     308                    warn "message => ", $error->{message}, "\n"; 
     309                } 
     310            } 
     311            else { 
     312                # unknown HASH structure 
     313                use Data::Dumper; 
     314                warn Dumper $twitter_error; 
     315            } 
    310316        } 
    311317    } 
Note: See TracChangeset for help on using the changeset viewer.