Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 64 lines (56 sloc) 1.868 kb
#!/usr/bin/perl
####################
#
# mmtter -- a "frontend" for ttytter
#
# Ben Cotton -- <bcotton@funnelfiasco.com> -- 2011
#
# Sometimes you're tweeting an event and you want to append a string to each
# tweet. This lets you do that, using Cameron Kaiser's TTYtter program (see
# www.floodgap.com/software/ttytter or @TTYtter on Twitter).
#
# Tweet content can be provided as arguments or else you'll be prompted for
# something to say. If using arguments, you'll need to escape characters that
# the shell cares about or enclose everything in single quotes.
#
# LICENSE: GPL v2.0 http://www.gnu.org/licenses/gpl-2.0.html
#
###################
use strict;
use warnings;
# Where's the ttytter command?
my $TTYTTER = "ttytter";
# If you use a non-default .ttytterrc, put it here
# Note that this is currently untested and may break things
my $TTYTTERRC = "";
# A delay (in seconds) before posting, to allow you time to ^C if things are
# not how you intended
my $DELAY = 5;
unless ( $TTYTTERRC eq "" ) {
$TTYTTER = "$TTYTTER -rc=$TTYTTERRC";
}
# What's the stuff to append?
my $APPEND = '(#mariomarathon live at http://ustre.am/VS3)';
# Build the string or prompt for it if there's nothing there.
my $tweet = '';
if ( @ARGV > 0 ) {
foreach ( @ARGV ) {
$tweet = $tweet . "$_ ";
}
} else {
print "What do you want to say? ";
chomp($tweet = <>);
# Append a space for the sake of readability
$tweet .= ' ';
}
# Check to make sure we don't exceed 140 characters and then send the message
if ( ( length($tweet) ) < ( 140 - length($APPEND) ) ) {
$tweet = $tweet . $APPEND;
print "\nSending $tweet \n";
sleep $DELAY;
open (OUTPUT, "| $TTYTTER -status=- ") or die "Couldn't pipe it to $TTYTTER\n";
print OUTPUT "$tweet" or die "Something went horribly wrong!\n";
close (OUTPUT);
} else {
print "Your tweet is too long. (That's what she said!)\n";
}
Jump to Line
Something went wrong with that request. Please try again.