/usr/share/doc/libanyevent-irc-perl/examples/version_dump is in libanyevent-irc-perl 0.97-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/usr/bin/env perl
# Dumps the version of the irc server and exits.
#
# Command line:
# $ ./version_dump <host> <port>
#
use common::sense;
use AnyEvent;
use AnyEvent::IRC::Client;
use AnyEvent::IRC::Util qw/mk_msg parse_irc_msg encode_ctcp/;
use Data::Dumper;
my $nick = "vtest1";
my ($server, $port) = @ARGV;
my $c = AnyEvent->condvar;
my $con = new AnyEvent::IRC::Client;
$con->reg_cb (
connect => sub {
my ($con, $err) = @_;
if (defined $err) {
warn "Couldn't connect: $err\n";
$c->broadcast;
}
$con->register ($nick, $nick, $nick);
},
registered => sub {
my ($con, $msg) = @_;
$con->send_srv ('VERSION');
},
irc_351 => sub {
# < :irctest.test 351 elmex hybrid-7.2.3(SVN). irctest.test :eGgIKM6 TS6ow
my ($con, $msg) = @_;
my @v = @{$msg->{params}};
print "$v[1]\n";
$con->disconnect ("done");
},
disconnect => sub {
$c->broadcast
},
);
$con->ctcp_auto_reply ('VERSION', ['VERSION', 'VersionDump:0.1:Perl']);
$con->connect ($server, $port || 6667);
$c->wait;
|