Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.