Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Parsing a Hash

by Old_Gray_Bear (Bishop)
on Jul 21, 2009 at 21:32 UTC ( #782091=note: print w/replies, xml ) Need Help??


in reply to Parsing a Hash

You probably ought to check the return from show_user(). According to the Net::Twitter documentation:

"When Net::Twitter encounters a Twitter API error or a network error, it throws a Net::Twitter::Error object. You can catch and process these exceptions by using eval blocks and testing $@"

The documentation has examples of how to error-proof your Twitter API calls.

----
I Go Back to Sleep, Now.

OGB

Replies are listed 'Best First'.
Re^2: Parsing a Hash
by northwestdev (Acolyte) on Jul 21, 2009 at 21:50 UTC
    The call is returning a valid hash. It's my syntax following the twitter API call that's problematic. When I do:
    my $nt = Net::Twitter->new( traits => [qw/API::REST/], username => $usename, password => $pwd ); my $results = $nt->show_user($twitterID); print Dumper $results;
    Here's what I get:
    $VAR1 = { 'friends_count' => 6, 'profile_background_tile' => bless( do +{\(my $o = 0)}, 'JSON::XS::Boolean' ), 'status' => { 'source' => 'Per +l Net::Twitter', 'favorited' => $VAR1->{'profile_background_tile'}, ' +truncated' => $VAR1->{'profile_background_tile'}, 'created_at' => 'Tu +e Jul 21 11:25:47 +0000 2009', 'text' => 'Checking server responses', + 'in_reply_to_user_id' => undef, 'id' => 2056026009, 'in_reply_to_sta +tus_id' => undef, 'in_reply_to_screen_name' => undef }, 'profile_imag +e_url' => 'http://s3.amazonaws.com/twitter_production/profile_images/ +000000000/January-2008__2__normal.JPG', 'profile_sidebar_fill_color' +=> 'e0ff92', 'profile_link_color' => '0000ff', 'profile_sidebar_borde +r_color' => '87bc44', 'created_at' => 'Thu Sep 11 23:45:20 +0000 2008 +', 'profile_background_color' => '9ae4e8', 'utc_offset' => -28800, 'n +otifications' => $VAR1->{'profile_background_tile'}, 'url' => 'http:/ +/www.mysite.com', 'verified' => $VAR1->{'profile_background_tile'}, ' +id' => 16249787, 'following' => $VAR1->{'profile_background_tile'}, ' +profile_background_image_url' => 'http://static.twitter.com/images/th +emes/theme1/bg.gif', 'screen_name' => 'myname', 'location' => 'WA', ' +followers_count' => 13, 'name' => 'myname', 'protected' => $VAR1->{'p +rofile_background_tile'}, 'statuses_count' => 8, 'description' => 'Te +chnology', 'profile_text_color' => '000000', 'time_zone' => 'Pacific +Time (US & Canada)', 'favourites_count' => 0 };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://782091]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2022-08-09 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?