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

    r43d739e ra5b6bf1  
    112112        warn $@->error; 
    113113        if ($@->twitter_error) { 
    114             my %twitter_error = %{$@->twitter_error}; 
    115             map { 
    116                 $twitter_error{"$_ => "} = $twitter_error{$_} . "\n"; 
    117                 delete $twitter_error{$_} 
    118             } keys %twitter_error; 
    119             warn join("", %twitter_error); 
     114            my $twitter_error = $@->twitter_error; 
     115            if (defined $twitter_error->{errors}) { 
     116                foreach my $error (@{$twitter_error->{errors}}) { 
     117                    warn "code => "   , $error->{code}, "\n"; 
     118                    warn "message => ", $error->{message}, "\n"; 
     119                } 
     120            } 
     121            else { 
     122                # unknown HASH structure 
     123                use Data::Dumper; 
     124                warn Dumper $twitter_error; 
     125            } 
    120126        } 
    121127    } 
Note: See TracChangeset for help on using the changeset viewer.