sample.pl untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 25 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl -w
2  
3 use strict;
4 use POE qw(Component::Client::Rcon);
5  
6 if(scalar(@ARGV) < 3) {
7 print STDERR "Usage: $0 ip:port password command\n";
8 exit 1;
9 }
10  
11 my ($ip, $port) = split(/\:/, $ARGV[0]);
12 $port = 27015 unless defined $port;
13 my $pw = $ARGV[1];
14 my $cmd = join(' ', splice(@ARGV, 2));
15  
16 POE::Session->create(
17 inline_states => {
18 _start => sub {
19 my $heap = $_[HEAP];
20 $heap->{rcon} = new POE::Component::Client::Rcon(
21 Alias => 'rcon',
22 Timeout => 15,
23 Retry => 1,
24 Bytes => 28000);
25 $poe_kernel->post('rcon', 'rcon', 'hl', $ip, $port,
26 $pw, $cmd, 'pb', undef);
27 },
28 pb => sub {
29 print $_[ARG5], "\n";
30 }
31 }
32 );
33 $poe_kernel->run();