Changeset a5b6bf1 in lab.git for Dev/twitter/dump_timeline.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/dump_timeline.pl

    rc1b8ad4 ra5b6bf1  
    160160        warn $@->error; 
    161161        if ($@->twitter_error) { 
    162             my %twitter_error = %{$@->twitter_error}; 
    163             map { 
    164                 $twitter_error{"$_ => "} = $twitter_error{$_} . "\n"; 
    165                 delete $twitter_error{$_} 
    166             } keys %twitter_error; 
    167             warn join("", %twitter_error); 
     162            my $twitter_error = $@->twitter_error; 
     163            if (defined $twitter_error->{errors}) { 
     164                foreach my $error (@{$twitter_error->{errors}}) { 
     165                    warn "code => "   , $error->{code}, "\n"; 
     166                    warn "message => ", $error->{message}, "\n"; 
     167                } 
     168            } 
     169            else { 
     170                # unknown HASH structure 
     171                use Data::Dumper; 
     172                warn Dumper $twitter_error; 
     173            } 
    168174        } 
    169175    } 
Note: See TracChangeset for help on using the changeset viewer.