Created
August 31, 2017 19:53
-
-
Save semifor/7d88ca39fd3e6d1f2752f2036946eec6 to your computer and use it in GitHub Desktop.
This file contains 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 -d | |
use 5.22.0; | |
use Getopt::Long; | |
use Twitter::API; | |
use open qw/:std :utf8/; | |
my @traits = qw/Enchilada/; | |
my $traits = ''; | |
GetOptions( | |
'traits=s', \$traits, | |
) or die "usage...\n"; | |
if ( $traits ) { | |
@traits = split /,/ => $traits; | |
} | |
my %cred = ( | |
consumer_key => $ENV{TWITTER_API_CONSUMER_KEY} // die, | |
consumer_secret => $ENV{TWITTER_API_CONSUMER_SECRET} // die, | |
access_token => $ENV{TWITTER_API_ACCESS_TOKEN} // die, | |
access_token_secret => $ENV{TWITTER_API_ACCESS_TOKEN_SECRET} // die, | |
); | |
my $client = Twitter::API->new_with_traits( | |
@traits ? ( traits => \@traits ): (), | |
%cred | |
); | |
$DB::deep = 1000; | |
$DB::single = 1; | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple REPL I use for ad-hoc Twitter API calls.
Set up the appropriate ENV variables. Run the script,
c<enter>
to run to the break point on line 30. Then make Twitter API calls. E.g.,Oh hey! Look at that 3rd tweet. Trump didn't tweet that. Someone on his communications team did.