» MetaCPAN » Perl » Programming » Creating a Twitter List of CPAN Authors

Creating a Twitter List of CPAN Authors

Recently I found a great little Twitter command line tool called t. It does a lot of useful things, including building and editing Twitter lists. For example, with the following commands we can:

  • create a Twitter list called "my-list-of-people"
  • add the @metacpan account to the list
  • display the accounts which are now in the list we've just created

I thought it would be fun to create a Twitter list of CPAN authors using some of the data in the MetaCPAN API. Authors can update their profiles on MetaCPAN to add one or more Twitter accounts. This data can then be found in the author type of the MetaCPAN API, in the profile key. To find out how many Twitter usernames of CPAN authors we can get, we'll create a script that looks something like this:

At this point you should be able to run this script, which prints the Twitter account names we are looking for. Now comes the Twitter integration. We could do this with a Perl module, but the point of this exercise is to use t.

The first thing you need to do is install t, the Twitter command line tool. Twitter OAuth is a bit cumbersome, so you'll also need to create your own OAuth app. The client will guide you through this process. If you run into any problems getting started once you've entered your OAuth keys, check issue #402 and specifically this comment.

Now all that's left is to create a list, run the script and pipe the output of the script to the new list.

That's it. Your list has now been created and you can curate it to your heart's content. As part of this exercise, I created an authors list for my own Twitter account. You can see my cpan-authors list in action.