diff options
author | Jonas Smedegaard <jonas@atreju.jones.dk> | 2012-10-11 16:14:25 +0200 |
---|---|---|
committer | Jonas Smedegaard <jonas@atreju.jones.dk> | 2012-10-11 16:14:25 +0200 |
commit | 846ec44317a52f347bfe0beb5a0d8af572631ffb (patch) | |
tree | 21c51f274a444d11ac4b1cb9ee536cbf4b0f6d6c | |
parent | 6eef9c02d29390a769671ccf83cbddfe4d44567e (diff) |
Use getopt more consistently (also at too few arguments.
-rwxr-xr-x | smsbot | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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 <jid> <password> <talkfile> [<conference room jid>]\n"; - exit; -} - read_messages ($inputfile); my $j = AnyEvent->condvar; |