Created
November 26, 2010 15:09
-
-
Save semifor/716823 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use warnings; | |
| use strict; | |
| use Net::Twitter; | |
| use Data::Dumper; | |
| my $nt = Net::Twitter->new(traits => [qw/API::REST/]); | |
| # uncomment the following line to simulate a failure | |
| #$nt->ua->add_handler(request_send => sub { HTTP::Response->new(503) }); | |
| eval { | |
| my $r = $nt->show_user({ screen_name => 'perl_api' }); | |
| print Dumper($r), "\n"; | |
| }; | |
| if ( $@ ) { | |
| print "Failed:\n", $@->http_response->as_string, "\n"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment