ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-IRC3/lib/Net/IRC3.pm
(Generate patch)

Comparing Net-IRC3/lib/Net/IRC3.pm (file contents):
Revision 1.7 by elmex, Mon Jul 17 15:09:20 2006 UTC vs.
Revision 1.8 by elmex, Mon Jul 17 16:01:04 2006 UTC

5 5
6our $ConnectionClass = 'Net::IRC3::Connection'; 6our $ConnectionClass = 'Net::IRC3::Connection';
7 7
8=head1 NAME 8=head1 NAME
9 9
10Net::IRC3 - An IRC Protocol module which is event system independend 10Net::IRC3 - An event system independend IRC protocol module
11 11
12=head1 VERSION 12=head1 VERSION
13 13
14Version 0.21 14Version 0.3
15 15
16=cut 16=cut
17 17
18our $VERSION = '0.21'; 18our $VERSION = '0.3';
19 19
20=head1 SYNOPSIS 20=head1 SYNOPSIS
21 21
22Using the simplistic L<Net::IRC3::Connection>:
23
24 use AnyEvent;
22 use Net::IRC3::Connection; 25 use Net::IRC3::Connection;
26
27 my $c = AnyEvent->condvar;
23 28
24 my $con = new Net::IRC3::Connection; 29 my $con = new Net::IRC3::Connection;
25 30
26 $con->connect ("test.not.at.irc.net", 6667); 31 $con->connect ("localhost", 6667);
27 32
33 $con->reg_cb (irc_001 => sub { print "$_[1]->{prefix} says i'm in the IRC: $_[1]->{trailing}!\n"; $c->broadcast; 0 });
34 $con->send_msg (undef, NICK => undef, "testbot");
35 $con->send_msg (undef, USER => 'testbot', "testbot", '*', '0');
36
37 $c->wait;
38
39Using the more sophisticatd L<Net::IRC3::Client::Connection>:
40
41 use AnyEvent;
42 use Net::IRC3::Client::Connection;
43
44 my $c = AnyEvent->condvar;
45
46 my $timer;
47 my $con = new Net::IRC3::Client::Connection;
48
49 $con->reg_cb (registered => sub { print "I'm in!\n"; 0 });
50 $con->reg_cb (disconnect => sub { print "I'm out!\n"; 0 });
51 $con->reg_cb (
52 sent => sub {
53 if ($_[2] eq 'PRIVMSG') {
54 print "Sent message!\n";
55 $timer = AnyEvent->timer (after => 1, cb => sub { $c->broadcast });
56 }
57 1
58 }
59 );
60
61 $con->send_srv (PRIVMSG => "Hello there i'm the cool Net::IRC3 test script!", 'elmex');
62
63 $con->connect ("localhost", 6667);
64 $con->register (qw/testbot testbot testbot/);
65
66 $c->wait;
67 undef $timer;
68
69 $con->disconnect;
28 70
29=head1 DESCRIPTION 71=head1 DESCRIPTION
30 72
31L<Net::IRC3> itself is a simple building block for an IRC client. 73The L<Net::IRC3> module consists of L<Net::IRC3::Connection>, L<Net::IRC3::Client::Connection>
74and L<Net::IRC3::Util>. L<Net::IRC3> only contains this documentation.
32It manages connections and parses and constructs IRC messages. 75It manages connections and parses and constructs IRC messages.
33 76
34L<Net::IRC3> is I<very> simple, if you don't want to care about 77L<Net::IRC3> is I<very> simple, if you don't want to care about
35all the other things that a client still has to do (like replying to 78all the other things that a client still has to do (like replying to
36PINGs and remembering who is on a channel), I recommend to read 79PINGs and remembering who is on a channel), I recommend to read

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines