Net::IRC2 - Client interface to the Internet Relay Chat protocol.


Net-IRC2 documentation Contained in the Net-IRC2 distribution.

Index


Code Index:

NAME

Top

Net::IRC2 - Client interface to the Internet Relay Chat protocol.

VERSION

Top

 !!! UNDER PROGRAMMING !!!
 You can use and feedback is welcome ( in english or french )

SYNOPSIS

Top

 use Net::IRC2                                                        ;
 my $bot  = new Net::IRC2                                             ;
 my $conn = $bot->newconn( uri => 'irc://Nick!User@localhost:6667/' ) ; 
 $conn->mode( $conn->nick, '+B' )                                     ;
 $conn->mode(  '#Ailleurs +m'   )                                     ;
 $bot->add_default_handler( \&process_event )                         ;
 $bot->start                                                          ;
 ...

DESCRIPTION

Top

This module will provide you an access to the IRC protocol suitable to write your own IRC-Bots, or your IRC Client. The API will provide you the sames functions than Net::IRC, so change should be trivial. This module use Parse::RecDescent; by Dr. Conway Damian.

FUNCTIONS

Top

new()

The constructor, takes no argument. Return a Net::IRC2 object. It's your IRC-Bot.

newconn()

Make a new connection. Like Net::IRC + can process a home-made tasty pseudo-URI : irc://Nick!User@localhost:6667/ . Yummy.

start()

Start the bot

add_handler()

set handler for all messages matching a command in commands list. $bot->add_handler( [ '001'..'005' ], \&function ) ;

add_default_handler()

The simple way to handle all events with only one function. set handler for ALL messages $bot->add_default_handler( \&function ) ;

connections()

return un ARRAY of Net::IRC2::Connection objects

irc_grammar()

! Internal !

callback()

! DEPRECATED !

BUGS

Top

Please report any bugs or feature requests to bug-net-irc2@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IRC2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

Top

Others Perl modules working with IRC connections: Net::IRC, POE::Component::IRC

IRC Request For Comment 1459 http://www.ietf.org/rfc/rfc1459.txt

AUTHOR

Top

Karl Y. Pradene, <knotty@cpan.org>, irc://knotty@freenode.org/

COPYRIGHT & LICENSE

Top


Net-IRC2 documentation Contained in the Net-IRC2 distribution.
#
# Copyright 2005, Karl Y. Pradene <knotty@cpan.org> All rights reserved.
#

package Net::IRC2;

use strict;      use warnings   ;
use Exporter                    ;
use Carp                        ;

our @ISA       = qw( Exporter ) ;
our @EXPORT_OK = qw( new      ) ;
our @Export    = qw( new      ) ;

use vars qw( $VERSION $DEBUG )  ;
$VERSION =                       '0.27' ;
$DEBUG   =                            0 ;


sub new         { shift and return bless {@_} } ;

sub newconn     {
    use Net::IRC2::Connection;
    my $self = shift;
    return $self->connections( Net::IRC2::Connection->new( @_,
							   _parent => $self ) );
}

sub add_default_handler { $_[0]->add_handler( [ 'WaterGate' ], $_[1] )          }

sub add_handler         { map { $_->add_handler( @_ ) } @{ shift->connections } }

sub start       {
    use threads;
    # FIXME
    my @threads = map { threads->create( sub { $_->start() } ) } @{$_[0]->connections};
    map { $_->join } @threads ;
}

sub connections {
    my ( $self, $param ) = @_                           ;
    return $self->{'connections'} unless defined $param ;
    push @{$self->{'connections'}}, $param              ;
    return $param                                       ;
                                                        }
sub callback    {
    my ( $self, $param ) = @_                                  ;
    if ( ref $param eq 'CODE' ) {
	map { $_->callback( $param ) } @{ $self->connections } ;
	return 0                                               ;
    }
    return $_[0]->{'callback'}( $param ) if defined $param     ;
                                                               }

1; # End of Net::IRC2



#This is the documentation for the Version __.__.__ of Net::IRC2 , released _______________.