Scripting Twitter with Perl + LWP

March 18th, 2007 by Stephane Kattoor

A little follow up on yesterday article about scripting Twitter with cURL: the solution was working, but somehow inconvenient. Not practical to have to go and fetch the user id every time you want to send a direct message !

This time, I scripted Twitter direct message with Perl and LWP (libwww-perl), for a much more convenient solution. I designed it to be used like a sort of universal paging service.

Running the script

Simply launch the script to get the usage :

spaghetti% ./twitter-direct.pl
Usage:
twitter-direct.pl --login login --password password --to user --text
"text to send"

Options:
–login
lets you specify the login of your Twitter account
–password
lets you specify your password
–to
the target user of the message
–text
the direct message to send
So for example :

spaghetti% ./twitter.pl --login mylogin --password mypassword --to "mybuddy"  --text 'Hi ! Want to go to the movie ?'

That’s it !

Download

Download the package

Related


Most Commented Posts

9 Responses to “Scripting Twitter with Perl + LWP”

  1. » Scripting Twitter with cURL « provided by Tech@Sakana Says:

    [...] Scripting Twitter with Perl + LWP : a script in Perl doing the same thing (much simpler). [...]

  2. Terminally Incoherent » Blog Archive » Posting Twitter Updates via Curl Says:

    [...] It turns out that curl is not the best way to send them – perl + lwp is. [...]

  3. Ozh Says:

    Awesome. I should make good use of this, merci ! :)

  4. Performans Yönetimi Says:

    thanks for your posts..great share for learners

  5. 50 Công c? Twitter hay dành cho Designers và Developers | Gi?i Pháp S? Says:

    [...] Scripting Twitter with cURL cURL is a versatile command-line utility designed to script Web page interactions. As a little demo, this tutorial shows you how to use it to easily to overcome the shortcomings of Twitter’s API. You can also view the Perl + LWP version of this tutorial here: Scripting Twitter with Perl + LWP [...]

  6. 50 Twitter Tools and Tutorials For Designers and Developers | ClickLogin Web Design Says:

    [...] Scripting Twitter with cURL cURL is a versatile command-line utility designed to script Web page interactions. As a little demo, this tutorial shows you how to use it to easily to overcome the shortcomings of Twitter’s API. You can also view the Perl + LWP version of this tutorial here: Scripting Twitter with Perl + LWP [...]

  7. 50 Twitter Tools and Tutorials For Designers and Developers | The Scripts Zone Says:

    [...] Scripting Twitter with cURL cURL is a versatile command-line utility designed to script Web page interactions. As a little demo, this tutorial shows you how to use it to easily to overcome the shortcomings of Twitter’s API. You can also view the Perl + LWP version of this tutorial here: Scripting Twitter with Perl + LWP [...]

  8. Perl + Tweet = Pweet « X marks reality Says:

    [...] sending direct messages though (if you do want to send direct msgs on the CLI via perl check out this post by Stéphane [...]

  9. 50 Twitter Tools and Tutorials For Designers and Developers | Tasar?m,Bilim,Müzik,Kitap,Sanat,Weblog Says:

    [...] Scripting Twitter with cURL cURL is a versatile command-line utility designed to script Web page interactions. As a little demo, this tutorial shows you how to use it to easily to overcome the shortcomings of Twitter’s API. You can also view the Perl + LWP version of this tutorial here: Scripting Twitter with Perl + LWP [...]

Leave a Reply