| 1 |
NAME |
| 2 |
Net::IRC3 - An IRC Protocol module which is event system independend |
| 3 |
|
| 4 |
VERSION |
| 5 |
Version 0.21 |
| 6 |
|
| 7 |
SYNOPSIS |
| 8 |
use Net::IRC3; |
| 9 |
|
| 10 |
my $irc3 = new Net::IRC3; |
| 11 |
|
| 12 |
my $con = $irc3->connect ("test.not.at.irc.net", 6667); |
| 13 |
|
| 14 |
... |
| 15 |
|
| 16 |
DESCRIPTION |
| 17 |
Net::IRC3 itself is a simple building block for an IRC client. It |
| 18 |
manages connections and parses and constructs IRC messages. |
| 19 |
|
| 20 |
Net::IRC3 is *very* simple, if you don't want to care about all the |
| 21 |
other things that a client still has to do (like replying to PINGs and |
| 22 |
remembering who is on a channel), I recommend to read the |
| 23 |
Net::IRC3::Client page instead. |
| 24 |
|
| 25 |
Note that this module uses AnyEvent as it's IO event subsystem. You can |
| 26 |
integrate Net::IRC3 into any GUI application that AnyEvent has support |
| 27 |
for. |
| 28 |
|
| 29 |
METHODS |
| 30 |
new () |
| 31 |
This just creates a Net::IRC3 object, which is a management class |
| 32 |
for creating and managing connections. |
| 33 |
|
| 34 |
connect ($host, $port) |
| 35 |
Tries to open a socket to the host $host and the port $port. If |
| 36 |
successfull it will return a Net::IRC3::Connection object. If an |
| 37 |
error occured it will die (use eval to catch the exception). |
| 38 |
|
| 39 |
connections () |
| 40 |
Returns a key value list, where the key is "$host:$port" and the |
| 41 |
value is the connection object. Only 'active' connections are |
| 42 |
returned. That means, if a connection is terminated somehow, it will |
| 43 |
also disappear from this list. |
| 44 |
|
| 45 |
connection ($host, $port) or connection ("$host:$port") |
| 46 |
Returns the Net::IRC3::Connection object for the $host $port pair. |
| 47 |
If no such connection exists, undef is returned. |
| 48 |
|
| 49 |
FUNCTIONS |
| 50 |
These are some utility functions that might come in handy when handling |
| 51 |
the IRC protocol. |
| 52 |
|
| 53 |
You can export these with eg.: |
| 54 |
|
| 55 |
use Net::IRC3 qw/parse_irc_msg/; |
| 56 |
|
| 57 |
parse_irc_msg ($ircline) |
| 58 |
This method parses the $ircline, which is one line of the IRC |
| 59 |
protocol without the trailing "\015\012". |
| 60 |
|
| 61 |
It returns a hash which has the following entrys: |
| 62 |
|
| 63 |
prefix |
| 64 |
The message prefix. |
| 65 |
|
| 66 |
command |
| 67 |
The IRC command. |
| 68 |
|
| 69 |
params |
| 70 |
The parameters to the IRC command in a array reference, this |
| 71 |
includes the trailing parameter (the one after the ':' or the |
| 72 |
14th parameter). |
| 73 |
|
| 74 |
trailing |
| 75 |
This is set if there was a trailing parameter (the one after the |
| 76 |
':' or the 14th parameter). |
| 77 |
|
| 78 |
mk_msg ($prefix, $command, $trailing, @params) |
| 79 |
This function assembles a IRC message. The generated message will |
| 80 |
look like (pseudo code!) |
| 81 |
|
| 82 |
:<prefix> <command> <params> :<trail> |
| 83 |
|
| 84 |
Please refer to RFC 2812 how IRC messages normally look like. |
| 85 |
|
| 86 |
The prefix and the trailing string will be omitted if they are |
| 87 |
"undef". |
| 88 |
|
| 89 |
EXAMPLES: |
| 90 |
|
| 91 |
mk_msg (undef, "PRIVMSG", "you suck!", "magnus"); |
| 92 |
# will return: "PRIVMSG magnus :you suck!\015\012" |
| 93 |
|
| 94 |
mk_msg (undef, "JOIN", undef, "#test"); |
| 95 |
# will return: "JOIN #magnus\015\012" |
| 96 |
|
| 97 |
split_prefix ($prefix) |
| 98 |
This function splits an IRC user prefix as described by RFC 2817 |
| 99 |
into the three parts: nickname, user and host. Which will be |
| 100 |
returned as a list with that order. |
| 101 |
|
| 102 |
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 103 |
|
| 104 |
prefix_nick ($prefix) |
| 105 |
A shortcut to extract the nickname from the $prefix. |
| 106 |
|
| 107 |
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 108 |
|
| 109 |
prefix_user ($prefix) |
| 110 |
A shortcut to extract the username from the $prefix. |
| 111 |
|
| 112 |
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 113 |
|
| 114 |
prefix_host ($prefix) |
| 115 |
A shortcut to extract the hostname from the $prefix. |
| 116 |
|
| 117 |
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 118 |
|
| 119 |
EXAMPLES |
| 120 |
See the samples/ directory for some examples on how to use Net::IRC3. |
| 121 |
|
| 122 |
AUTHOR |
| 123 |
Robin Redeker, "<elmex@ta-sa.org>" |
| 124 |
|
| 125 |
SEE ALSO |
| 126 |
Net::IRC3::Connection |
| 127 |
|
| 128 |
Net::IRC3::Client |
| 129 |
|
| 130 |
RFC 2812 - Internet Relay Chat: Client Protocol |
| 131 |
|
| 132 |
BUGS |
| 133 |
Please report any bugs or feature requests to "bug-net-irc3 at |
| 134 |
rt.cpan.org", or through the web interface at |
| 135 |
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IRC3>. I will be |
| 136 |
notified, and then you'll automatically be notified of progress on your |
| 137 |
bug as I make changes. |
| 138 |
|
| 139 |
SUPPORT |
| 140 |
You can find documentation for this module with the perldoc command. |
| 141 |
|
| 142 |
perldoc Net::IRC3 |
| 143 |
|
| 144 |
You can also look for information at: |
| 145 |
|
| 146 |
* AnnoCPAN: Annotated CPAN documentation |
| 147 |
<http://annocpan.org/dist/Net-IRC3> |
| 148 |
|
| 149 |
* CPAN Ratings |
| 150 |
<http://cpanratings.perl.org/d/Net-IRC3> |
| 151 |
|
| 152 |
* RT: CPAN's request tracker |
| 153 |
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-IRC3> |
| 154 |
|
| 155 |
* Search CPAN |
| 156 |
<http://search.cpan.org/dist/Net-IRC3> |
| 157 |
|
| 158 |
ACKNOWLEDGEMENTS |
| 159 |
Thanks to Marc Lehmann for the new AnyEvent module! |
| 160 |
|
| 161 |
COPYRIGHT & LICENSE |
| 162 |
Copyright 2006 Robin Redker, all rights reserved. |
| 163 |
|
| 164 |
This program is free software; you can redistribute it and/or modify it |
| 165 |
under the same terms as Perl itself. |
| 166 |
|