Skip to content

Instantly share code, notes, and snippets.

@issm
Created December 5, 2011 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save issm/1435242 to your computer and use it in GitHub Desktop.
Save issm/1435242 to your computer and use it in GitHub Desktop.
post-ikachan.pl
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Getopt::Long;
my $CURL = "curl -s";
my ($channel);
my $parser = Getopt::Long::Parser->new;
my %options;
$parser->getoptions(
'channel=s' => \$channel,
'h|help' => \$options{help},
);
die 'Missing mandatory parameter: channel' unless defined $channel;
$channel = '#' . $channel unless $channel =~ /^\#/;
my $buff;
{
local $/;
$buff = <STDIN>;
};
my $cmd_join = "$CURL -F channel=$channel http://localhost:4979/join";
`$cmd_join`;
for my $l ( split /\n/, $buff ) {
my $message = $l;
my $cmd_notice = "$CURL -F channel=$channel -F message=\"${message}\" http://localhost:4979/notice";
`$cmd_notice`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment