Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

+ -

  Twitter-pated on 2007.09.21 17:46 rjray

Submitted by rjray on 2007.09.21 17:46
User Journal
rjray writes "I have a (reasonably stable) Twitter-bot up and running. Like the existing "cpan" Twitter, it spools CPAN uploads to Twitter from the RDF that www.cpan.org publishes. Unlike "cpan" (which was apparently shut-off a little over a month ago anyway), it provides links: The released package itself is linked, and behind the scenes the MANIFEST file is scanned for something matching /(changes|changelog|changelist)\b/i and if found is also linked. If no change-file is found, README is linked to instead (unless there's no README, in which case you just get the one link instead of two).

The bot polls the RDF URL every 15min or so, using an If-Modified-Since header. Any new CPAN uploads are queued up for posting to Twitter, spaced out evenly over the 15min waiting period (i.e., if there are two new CPAN uploads then tweet fires immediately and the second waits roughly 7.5 minutes to fire... fifteen new uploads would fire at roughly one-minute intervals) so that it doesn't suddenly spam your Twitter client.

This is still largely alpha, though the code itself is reasonably clean (one must love being borderline-OCD). I want to add better local logging, reading of direct messages to interpret them as commands, stats tracking, etc. to it yet. Also, I plan to abstract the overall architecture moreso than it currently is, and CPAN that as a Twitterbot sort of class/mini-framework. For that matter, the structure of the message that gets sent as a tweet is itself vulnerable to change yet, as I'm not 100% happy with it (but as far as I know, I can't use HTML for formatting, so I can't (for example) link the module name to the CPAN page, I can only send the URL in the message body and rely on clients like IM or Twitterific to hot-link the text).

For now, though, you can get your CPAN addiction fed via Twitter at:

(I'm also thinking about changing the name to "cpan_with_links". Alternately, if the current owner of the "cpan" Twitter account wants to talk, feel free to e-mail me.)

"
Read More 0 comments

This discussion was created as logged-in users only. Log in and try again!
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.