Net-Async-IRC

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME

    Net::Async::IRC - use IRC with IO::Async

SYNOPSIS

       use Future::AsyncAwait;
    
       use IO::Async::Loop;
       use Net::Async::IRC;
    
       my $loop = IO::Async::Loop->new;
    
       my $irc = Net::Async::IRC->new(
          on_message_text => sub {
             my ( $self, $message, $hints ) = @_;
    
             print "$hints->{prefix_name} says: $hints->{text}\n";
          },
       );
    
       $loop->add( $irc );
    
       await $irc->login(
          nick => "MyName",
          host => "irc.example.org",
       );
    
       await $irc->do_PRIVMSG( target => "YourName", text => "Hello world!" );
    
       $loop->run;

DESCRIPTION

    This object class implements an asynchronous IRC client, for use in
    programs based on IO::Async.

    Most of the actual IRC message handling behaviour is implemented by the
    parent class Net::Async::IRC::Protocol.

    Most of the behaviour related to being an IRC client is implemented by
    the parent class Protocol::IRC::Client.

    The following documentation may make mention of these above two parent
    classes; the reader should make reference to them when required.

PARAMETERS

    The following named parameters may be passed to new or configure:

    nick => STRING

    user => STRING

    realname => STRING

      Connection details. See also connect, login.

      If user is not supplied, it will default to either $ENV{LOGNAME} or
      the current user's name as supplied by getpwuid() or
      Win32::LoginName().

      If unconnected, changing these properties will set the default values
      to use when logging in.

      If logged in, changing the nick property is equivalent to calling
      change_nick. Changing the other properties will not take effect until
      the next login.

    use_caps => ARRAY of STRING

      Attempts to negotiate IRC v3.1 CAP at connect time. The array gives
      the names of capabilities which will be requested, if the server
      supports them.

      If the sasl capability is requested and supported by the server, the
      login method will use that.

METHODS

    The following methods documented in an await expression return Future
    instances.

 connect

       $irc = await $irc->connect( %args );

    Connects to the IRC server. This method does not perform the complete
    IRC login sequence; for that see instead the login method. The returned
    Future will yield the $irc instance itself, to make chaining easier.

    host => STRING

      Hostname of the IRC server.

    service => STRING or NUMBER

      Optional. Port number or service name of the IRC server. Defaults to
      6667.

    Any other arguments are passed into the underlying IO::Async::Loop
    connect method.

       $irc->connect( %args );

    The following additional arguments are used to provide continuations
    when not returning a Future.

    on_connected => CODE

      Continuation to invoke once the connection has been established.
      Usually used by the login method to perform the actual login
      sequence.

         $on_connected->( $irc )

    on_error => CODE

      Continuation to invoke in the case of an error preventing the
      connection from taking place.



( run in 0.696 second using v1.01-cache-2.11-cpan-39bf76dae61 )