Skip to content

Instantly share code, notes, and snippets.

@semifor
Created November 26, 2010 15:09
Show Gist options
  • Select an option

  • Save semifor/716823 to your computer and use it in GitHub Desktop.

Select an option

Save semifor/716823 to your computer and use it in GitHub Desktop.
#!/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