Debian Codegraph @

samples/test_connect

raw
1 #!/usr/bin/env perl
2 use AnyEvent;
3 use AnyEvent::IRC::Connection;
4
5 my $c = AnyEvent->condvar;
6
7 my $con = new AnyEvent::IRC::Connection;
8
9 $con->connect ("localhost", 6667);
10
11 $con->reg_cb (
12 connect => sub {
13 my ($con) = @_;
14
15 $con->send_msg (NICK => "testbot");
16 $con->send_msg (USER => "testbot", '*', '0', 'testbot');
17 },
18 irc_001 => sub {
19 my ($con, $msg) = @_;
20 print "$msg->{prefix} says i'm in the IRC: $msg->{params}->[-1]!\n";
21 $c->broadcast
22 }
23 );
24
25 $c->wait;