| Subcribe via RSS

Perl Module Monday: Net::Twitter(::Lite)

September 28th, 2009 Posted in CPAN, GitHub, Perl, Twitter

(If I keep covering multiple modules in a post, I’m going to have to change the title and tag I use…)

I generally try to use these posts to highlight lesser-known modules, and I imagine that the Net::Twitter module is fairly higher-profile than most of my previous choices. But are you familiar with Net::Twitter::Lite, as well?

It’s not unusual for CPAN to offer more than one solution to a given problem. The wide range of XML parsers is a testament to this. And when a subject is popular, the odds are even greater that people may choose to “roll their own” rather than trying to contribute to an existing effort. Fortunately, the interface to the social messaging service Twitter has been spared this. Maybe it’s because the source code is hosted on GitHub, and thus it is easier for people to contribute. Whatever the reason, the only real competition to Net::Twitter for basic Twitter API usage is Net::Twitter::Lite. And it’s not actually a competitor in the general sense.

Rather than representing a competing implementation, Net::Twitter::Lite came about as an (almost completely) interface-compatible alternative to Net::Twitter after it was refactored to use Moose internally. While it doesn’t have 100% of the features that Net::Twitter has, both modules strive for 100% coverage of Twitter’s API. Where N::T::Lite runs without the additional requirement of Moose, N::T gives you finer-grained control over which parts of the API are loaded and made available to connection objects.

I’ve used both modules, and can attest to the fact that the interface is kept consistent between them. At $DAY_JOB I authored a tool to echo data to a Twitter stream, for which N::T::L was the best choice as it had the fewest dependencies and our needs did not call for the additional functionality of N::T. My Twitter-bot (cpan_linked) was written with N::T in the pre-Moose days, and has not had a single problem since I seamlessly upgraded N::T to the Moose-based version. As I work on the next generation CPAN-bot, I’ll be using the OAuth support, as well as possibly the search API. Since it will be a long-running daemon, I’ll stick with the more-featureful N::T for it. But thanks to the diligence of the modules’ authors, I could just as easily swap between them at will.

If you’re planning to interface to Twitter from Perl, these two modules should be your starting point. But be sure to look at the other Twitter-oriented modules, just to be sure. There’s a lot of activity around this API, and Perl developers have kept on top of it.

4 Responses to “Perl Module Monday: Net::Twitter(::Lite)”

  1. CosimoNo Gravatar Says:

    Hi! Since you worked with both these modules already… do you know (i’m lazy) if Net::Twitter::Lite supports OAuth?

  2. Phillip SmithNo Gravatar Says:

    Using it myself right now. Love it. Great module. :-)

  3. Dereferenced.com » Blog Archive » Perl Module Monday: Timeout::Queue Says:

    [...] the time. So I plan to use it in my ongoing re-write (which isn’t much further along than the last time I mentioned [...]

  4. ClintJCLNo Gravatar Says:

    Yes, Lite uses oAuth.

    My problem is that these modules simply WILL NOT COMPILE on my Strawberry Perl Windows 7 64-bit installation. They are fine on my Windows 7 32-bit installation. Wondering what I’m doing wrong…

Leave a Reply