« reading for the year | Main | hitting a ton »

twitter command-line status script

A long time ago, when nearly everybody I ever (thought I) wanted to talk to used goofey to communicate, one particular friend would often ask "what doing?". twitter seems made just for people like him. So in a retro moment I wrote some Perl to answer the age-old question from the comfort of the command-line, via twitter. It's called wd.

Once I'd written the "get" support, it wasn't too hard to add "set" support.

To use it, you'll need the Perl JSON module, and LWP. [update: and also DateTime::Format::Strptime - it'll sort the output by date, now.]

Getting status:

for all your friends

% wd
yeled: dreaming about driving into Western Australia as a fugitive a lot lately.. (about 16 hours ago)
wally: Sitting (about 21 hours ago)

for one particular friend

% wd wally
wally: Sitting (about 21 hours ago)

Setting status:

% wd -sv blogging. overdue for sleep
status set to: blogging. overdue for sleep

(if you leave the -v option out it'll shut up unless there's an error, in true Unix style.)

[update: there seems to be missing data in the feeds - if somebody marked their status as "friends-only", then you don't get a status object for them in the JSON and XML "friends status" feed. i've asked about it...]

Anyway, here's the script. Have fun!


size: 4 KB.
last modified: 2008-06-07.

* 23:18 * geek