#!/usr/bin/perl # Author: Kevin P. Inscoe . # File: tweet.pl # Date of creation: April, 8, 2008 # Version: 1.1 # # The purpose of this program is # # Take command line from shell script (tweet.sh) and send the message to # Twitter. # # Change history: # # 0.9.0 - 04/08/2008 - Create original # 1.0.0 - 04/21/2008 - Release working version # # Warranty: None expressed or implied. # License: The Open Software License. V1.1 http://www.opensource.org/licenses/osl.php # # OSI Certified Open Source Software. http://www.opensource.org/licenses/ # # Prerequisites: Perl 5.004 (minimum). # require 5.004; # Pragmas use strict; use diagnostics; use LWP::UserAgent; use Net::Twitter; # Global variables my $DEBUG = 1; my $prog = $0; my $tweet = $ARGV[0]; # Local variables my $twitter = $ENV{'twitter'}; my $twpass = $ENV{'twpass'}; # Check parameters for required my $num_args = $#ARGV + 1; if ( $num_args < 1 ) { print "tweet.pl usage:\n"; print "\n"; print "$prog \"message to send\"\n"; print "\n"; exit 0; } # Send the Tweet if ($DEBUG == "1") { print "Tweeting: $tweet\n"; } my $twit = Net::Twitter->new(username=>$twitter, password=>$twpass); my $result = $twit->update("$tweet"); exit;