AnyEvent-IRC
view release on metacpan or search on metacpan
samples/debug_console view on Meta::CPAN
# This is a simple script that connects stdin/stdout with a client
# connection to an irc server. the command line arguments are:
#
# $ ./debug_console <nick> <server> <port>
#
use common::sense;
use IO::Handle;
use AnyEvent;
use AnyEvent::IRC::Client;
use AnyEvent::IRC::Util qw/mk_msg parse_irc_msg encode_ctcp/;
use Data::Dumper;
my ($nick, $server, $port) = @ARGV;
my $c = AnyEvent->condvar;
my $stdout = AnyEvent::Handle->new (fh => \*STDOUT);
my $con = new AnyEvent::IRC::Client;
$con->reg_cb (
connect => sub {
my ($con, $err) = @_;
samples/debug_console view on Meta::CPAN
},
on_read => sub {
$stdin->push_read (line => sub {
my ($stdin, $line) = @_;
if ($line =~ /^!/) {
my $r = eval $line;
if ($@) {
warn "eval error: $@\n";
} else {
$Data::Dumper::Terse = 1;
$stdout->push_write ("result: " . Data::Dumper::Dumper ($r));
}
} else {
my $msg = parse_irc_msg ($line);
$con->send_msg ($msg->{command}, @{$msg->{params}});
}
});
}
);
},
disconnect => sub {
samples/version_dump view on Meta::CPAN
#!/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) = @_;
( run in 0.285 second using v1.01-cache-2.11-cpan-4d50c553e7e )