2008年6月1日 星期日

Twitter + Bash == Bad Idea

what I am doing, RIGHT NOW
http://www.kroah.com/log/diary/2008_04_14.html


twitter
http://twitter.com/

Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing?
Twitter + Bash == Bad Idea
http://blog.unixdaemon.net/cgi-bin/blosxom.pl/geekstuff/twitter_and_bash_bad_ideas.html

I'm not sure about the basic idea behind Twitter but after signing up, having a little look and noticing the Net::Twitter CPAN module I decided to implement a really bad idea...
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::Twitter;

my $bot = Net::Twitter->new(
username => "username",
password => "password"
);

chomp(my $doing = <>);
$doing =~ s/^\s+\d+\s+//;

$bot->update($doing);
To make it 'useful' you'll need to run the following in your bash shell: PROMPT_COMMAND='history | tail -n 1 | /path/to/twitter_post.pl' and tada! People really will know what you're doing RIGHT NOW. Ahem, sorry.

Twitter / gregkh
http://twitter.com/gregkh

沒有留言: