ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Net-IRC3/samples/netirc3cl
Revision: 1.1
Committed: Sun Jul 16 02:09:12 2006 UTC (20 years, 2 months ago) by elmex
Branch: MAIN
Log Message:
initial checkin

File Contents

# User Rev Content
1 elmex 1.1 #!/usr/bin/perl
2     use strict;
3     use Net::IRC3::Client;
4     $Net::IRC3::Client::DEBUG = 1;
5    
6     my $c = AnyEvent->condvar;
7    
8    
9     my $i = Net::IRC3::Client->new;
10    
11     my $pc = $i->connect ("irc.schmorp.de", 6667, "net_irc3", "net_irc3", "test bot");
12    
13     $pc->send_chan ("#test", "PRIVMSG", "hi, i'm a bot!", "#test");
14     $pc->send_srv ("JOIN", undef, "#test");
15    
16     $pc->reg_cb (
17     irc_privmsg => sub {
18     my ($self, $msg) = @_;
19     if ($msg->{trailing} =~ m/net_irc3:\s*(.*)/) {
20     $pc->send_chan ("#test", "PRIVMSG", "yes?", "#test");
21     }
22     }
23     );
24    
25     $pc->reg_cb (
26     disconnect => sub {
27     print "DISCOPNNECT!!!\n";
28     }
29     );
30    
31     $pc->register;
32    
33     $c->wait;