From 846ec44317a52f347bfe0beb5a0d8af572631ffb Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 11 Oct 2012 16:14:25 +0200 Subject: Use getopt more consistently (also at too few arguments. --- smsbot | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/smsbot b/smsbot index 6cf5995..f90ebc2 100755 --- a/smsbot +++ b/smsbot @@ -31,7 +31,9 @@ my ($opt, $usage) = describe_options( [ 'help', "print usage message and exit"], ); -print($usage->text), exit if $opt->help; +print($usage->text), exit if ($opt->help or @ARGV < 3); + +my ($jid, $pw, $inputfile, $room) = @ARGV; # TODO: support overriding full URL # TODO: use URI module to construct URL @@ -60,13 +62,6 @@ sub answer_to { binmode STDOUT, ":utf8"; -my ($jid, $pw, $inputfile, $room) = @ARGV; - -unless (@ARGV >= 3) { - warn "usage: talkbot []\n"; - exit; -} - read_messages ($inputfile); my $j = AnyEvent->condvar; -- cgit v1.2.3