Created
December 5, 2011 20:37
-
-
Save issm/1435242 to your computer and use it in GitHub Desktop.
post-ikachan.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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