IRC3.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 15 / 15 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« IRC3/Connection.pm ↑ Summary
1 package Net::IRC3;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use AnyEvent;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use IO::Socket::INET;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $ConnectionClass = 'Net::IRC3::Connection';
7  
8 =head1 NAME
9  
10 Net::IRC3 - An event system independend IRC protocol module
11  
12 =head1 VERSION
13  
14 Version 0.6
15  
16 =cut
17  
18 1 our $VERSION = '0.6';
19  
20 =head1 SYNOPSIS
21  
22 Using the simplistic L<Net::IRC3::Connection>:
23  
24 use AnyEvent;
25 use Net::IRC3::Connection;
26  
27 my $c = AnyEvent->condvar;
28  
29 my $con = new Net::IRC3::Connection;
30  
31 $con->connect ("localhost", 6667);
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  
39 Using 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;
70  
71 =head1 DESCRIPTION
72  
73 B<NOTE:> This module is B<DEPRECATED>, please use L<AnyEvent::IRC> for new programs,
74 and possibly port existing L<Net::IRC3> applications to L<AnyEvent::IRC>. Though the
75 API of L<AnyEvent::IRC> has incompatible changes, it's still fairly similar.
76  
77 The L<Net::IRC3> module consists of L<Net::IRC3::Connection>, L<Net::IRC3::Client::Connection>
78 and L<Net::IRC3::Util>. L<Net::IRC3> only contains this documentation.
79 It manages connections and parses and constructs IRC messages.
80  
81 L<Net::IRC3> can be viewed as toolbox for handling IRC connections
82 and communications. It won't do everything for you, and you still
83 need to know a few details of the IRC protocol.
84  
85 L<Net::IRC3::Client::Connection> is a more highlevel IRC connection
86 that already processes some messages for you and will generated some
87 events that are maybe useful to you. It will also do PING replies for you
88 and manage channels a bit.
89  
90 L<Net::IRC3::Connection> is a lowlevel connection that only connects
91 to the server and will let you send and receive IRC messages.
92 L<Net::IRC3::Connection> does not imply any client behaviour, you could also
93 use it to implement an IRC server.
94  
95 Note that the *::Connection module uses AnyEvent as it's IO event subsystem.
96 You can integrate them into any application with a event system
97 that AnyEvent has support for (eg. L<Gtk2> or L<Event>).
98  
99 =head1 EXAMPLES
100  
101 See the samples/ directory for some examples on how to use Net::IRC3.
102  
103 =head1 AUTHOR
104  
105 Robin Redeker, C<< <elmex@ta-sa.org> >>
106  
107 =head1 SEE ALSO
108  
109 L<Net::IRC3::Util>
110  
111 L<Net::IRC3::Connection>
112  
113 L<Net::IRC3::Client::Connection>
114  
115 L<AnyEvent>
116  
117 RFC 2812 - Internet Relay Chat: Client Protocol
118  
119 =head1 BUGS
120  
121 Please report any bugs or feature requests to
122 C<bug-net-irc3 at rt.cpan.org>, or through the web interface at
123 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IRC3>.
124 I will be notified, and then you'll automatically be notified of progress on
125 your bug as I make changes.
126  
127 =head1 SUPPORT
128  
129 You can find documentation for this module with the perldoc command.
130  
131 perldoc Net::IRC3
132  
133 You can also look for information at:
134  
135 =over 4
136  
137 =item * AnnoCPAN: Annotated CPAN documentation
138  
139 L<http://annocpan.org/dist/Net-IRC3>
140  
141 =item * CPAN Ratings
142  
143 L<http://cpanratings.perl.org/d/Net-IRC3>
144  
145 =item * RT: CPAN's request tracker
146  
147 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-IRC3>
148  
149 =item * Search CPAN
150  
151 L<http://search.cpan.org/dist/Net-IRC3>
152  
153 =back
154  
155 =head1 ACKNOWLEDGEMENTS
156  
157 Thanks to Marc Lehmann for the new AnyEvent module!
158  
159 =head1 COPYRIGHT & LICENSE
160  
161 Copyright 2006 Robin Redeker, all rights reserved.
162  
163 This program is free software; you can redistribute it and/or modify it
164 under the same terms as Perl itself.
165  
166 =cut
167  
168 1 1;
« IRC3/Connection.pm ↑ Summary