<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Mojo::IRC - IRC Client for the Mojo IOLoop

VERSION
    0.03

SYNOPSIS
      my $irc = Mojo::IRC-&gt;new(
                  nick =&gt; 'test123',
                  user =&gt; 'my name',
                  server =&gt; 'irc.perl.org:6667',
                );

      $irc-&gt;on(irc_join =&gt; sub {
        my($self, $message) = @_;
        warn "yay! i joined $message-&gt;{params}[0]";
      });

      $irc-&gt;on(irc_privmsg =&gt; sub {
        my($self, $message) = @_;
        say $message-&gt;{prefix}, " said: ", $message-&gt;{params}[1];
      });

      $irc-&gt;connect(sub {
        my($irc, $err) = @_;
        return warn $err if $err;
        $irc-&gt;write(join =&gt; '#mojo');
      });

      Mojo::IOLoop-&gt;start;

DESCRIPTION
    This class inherit from Mojo::EventEmitter.

    TODO:

      * Authentication with password
      * SSL
      * use IRC::Utils qw/ decode_irc /;

EVENTS
  close
    Emitted once the connection to the server close.

  error
    Emitted once the stream emits an error.

  irc_close
    Called when the client has closed the connection.

  irc_error
    This event is used by IRC errors

  irc_err_nicknameinuse
  irc_join
      $self-&gt;$callback({
        params =&gt; ['#html'],
        raw_line =&gt; ':somenick!~someuser@1.2.3.4 JOIN #html',
        command =&gt; 'JOIN',
        prefix =&gt; 'somenick!~someuser@1.2.3.4'
      });

  irc_nick
      $self-&gt;$callback({
        params =&gt; ['newnick'],
        raw_line =&gt; ':oldnick!~someuser@hostname.com MODE somenick :+i',
        command =&gt; 'NICK',
        prefix =&gt; 'somenick!~someuser@hostname.com'
      });

  irc_mode
      $self-&gt;$callback({
        params =&gt; ['somenick', '+i'],
        raw_line =&gt; ':somenick!~someuser@hostname.com MODE somenick :+i',
        command =&gt; 'MODE',
        prefix =&gt; 'somenick!~someuser@hostname.com'
      });

  irc_notice
      $self-&gt;$callback({
        params =&gt; ['somenick', 'on 1 ca 1(4) ft 10(10)'],
        raw_line =&gt; ':Zurich.CH.EU.Undernet.Org NOTICE somenick :on 1 ca 1(4) ft 10(10)',
        command =&gt; 'NOTICE',
        prefix =&gt; 'Zurich.CH.EU.Undernet.Org',
      });

  irc_part
      $self-&gt;$callback({
        command =&gt; 'PART',
        params =&gt; ['#channel'],
        raw_line =&gt; ':somenick!~someuser@host PART #channel',
        prefix =&gt; 'somenick!~someuser@host',
      })

  irc_ping
      $self-&gt;$callback({
        params =&gt; [2687237629],
        raw_line =&gt; 'PING :2687237629',
        command =&gt; 'PING',
      })

  irc_privmsg
      $self-&gt;$callback({
        params =&gt; [ '#channel', 'some message' ],
        raw_line =&gt; ':nick!user@host PRIVMSG #nms :some message',
        command =&gt; 'PRIVMSG',
        prefix =&gt; 'nick!user@host',
      });

  irc_rpl_created
      $self-&gt;$callback({
        params =&gt; ['somenick', 'This server was created Thu Jun 21 2012 at 01:26:15 UTC'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 003 somenick :This server was created Thu Jun 21 2012 at 01:26:15 UTC',
        command =&gt; '003',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      });

  irc_rpl_endofmotd
  irc_rpl_endofnames
      $self-&gt;$callback({
        params =&gt; ['somenick', '#channel', 'End of /NAMES list.'],
        raw_line =&gt; ':Budapest.Hu.Eu.Undernet.org 366 somenick #channel :End of /NAMES list.',
        command =&gt; '366',
        prefix =&gt; 'Budapest.Hu.Eu.Undernet.org'
      });

  irc_rpl_isupport
      $self-&gt;$callback({
        params =&gt; ['somenick', 'WHOX', 'WALLCHOPS', 'WALLVOICES', 'USERIP', 'CPRIVMSG', 'CNOTICE', 'SILENCE=25', 'MODES=6', 'MAXCHANNELS=20', 'MAXBANS=50', 'NICKLEN=12', 'are supported by this server'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 005 somenick WHOX WALLCHOPS WALLVOICES USERIP CPRIVMSG CNOTICE SILENCE=25 MODES=6 MAXCHANNELS=20 MAXBANS=50 NICKLEN=12 :are supported by this server',
        command =&gt; '005',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      })

  irc_rpl_luserchannels
      $self-&gt;$callback({
        params =&gt; ['somenick', '13700', 'channels formed'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 254 somenick 13700 :channels formed',
        command =&gt; '254',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      })

  irc_rpl_luserclient
      $self-&gt;$callback({
        params =&gt; ['somenick', 'There are 3400 users and 46913 invisible on 18 servers'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 251 somenick :There are 3400 users and 46913 invisible on 18 servers',
        command =&gt; '251',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      });

  irc_rpl_luserme
      $self-&gt;$callback({
        params =&gt; ['somenick', 'I have 12000 clients and 1 servers'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 255 somenick :I have 12000 clients and 1 servers',
        command =&gt; '255',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      });

  irc_rpl_luserop
      $self-&gt;$callback({
        params =&gt; ['somenick', '19', 'operator(s) online'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 252 somenick 19 :operator(s) online',
        command =&gt; '252',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      });

  irc_rpl_luserunknown
      $self-&gt;$callback({
        params =&gt; ['somenick', '305', 'unknown connection(s)'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 253 somenick 305 :unknown connection(s)',
        command =&gt; '253',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      })

  irc_rpl_motd
  irc_rpl_motdstart
  irc_rpl_myinfo
      $self-&gt;$callback({
        params =&gt; ['somenick', 'Tampa.FL.US.Undernet.org', 'u2.10.12.14', 'dioswkgx', 'biklmnopstvrDR', 'bklov'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 004 somenick Tampa.FL.US.Undernet.org u2.10.12.14 dioswkgx biklmnopstvrDR bklov',
        command =&gt; '004',
        prefix =&gt; 'Tampa.FL.US.Undernet.org',
      })

  irc_rpl_namreply
      $self-&gt;$callback({
        params =&gt; ['somenick', '=', '#html', 'somenick Indig0 Wildblue @HTML @CSS @Luch1an @Steaua_ Indig0_ Pilum @fade'],
        raw_line =&gt; ':Budapest.Hu.Eu.Undernet.org 353 somenick = #html :somenick Indig0 Wildblue @HTML @CSS @Luch1an @Steaua_ Indig0_ Pilum @fade',
        command =&gt; '353',
        prefix =&gt; 'Budapest.Hu.Eu.Undernet.org'
      })

  irc_rpl_welcome
      $self-&gt;$callback({
        params =&gt; ['somenick', 'Welcome to the UnderNet IRC Network, somenick'],
        raw_line =&gt; ':Zurich.CH.EU.Undernet.Org 001 somenick :Welcome to the UnderNet IRC Network, somenick',
        command =&gt; '001',
        prefix =&gt; 'Zurich.CH.EU.Undernet.Org'
      })

  irc_rpl_yourhost
      $self-&gt;$callback({
        params =&gt; ['somenick', 'Your host is Tampa.FL.US.Undernet.org, running version u2.10.12.14'],
        raw_line =&gt; ':Tampa.FL.US.Undernet.org 002 somenick :Your host is Tampa.FL.US.Undernet.org, running version u2.10.12.14',
        command =&gt; '002',
        prefix =&gt; 'Tampa.FL.US.Undernet.org'
      });

ATTRIBUTES
  ioloop
    Holds an instance of Mojo::IOLoop.

  real_host
    Will be set by "irc_rpl_welcome". Holds the actual hostname of the IRC
    server that we are connected to.

  user
    IRC username.

  nick
    IRC nick name accessor.

  server
    Server name and optionally a port to connect to. Changing this while
    connected to the IRC server will issue a reconnect.

  name
    The name of this IRC client. Defaults to "Mojo IRC".

  pass
    Password for authentication

  tls
      $self-&gt;tls(undef) # disable (default)
      $self-&gt;tls({}) # enable

    Default is "undef" which disable TLS. Setting this to an empty hash will
    enable TLS and this module will load in default certs. It is also
    possible to set custom cert/key:

      $self-&gt;tls({ cert =&gt; "/path/to/client.crt", key =&gt; ... })

    This can be generated using

      # certtool --generate-privkey --outfile client.key
      # certtool --generate-self-signed --load-privkey client.key --outfile client.crt

METHODS
  change_nick
    Change IRC nick name. This command will change the "nick" attribute if
    not connected to the server.

  connect
      $self-&gt;connect(\&amp;callback);

    Will login to the IRC "server" and call &amp;callback once connected. The
    &amp;callback will be called once connected or if it fail to connect. The
    second argument will be an error message or empty string on success.

  disconnect
      $self-&gt;disconnect(\&amp;callback);

    Will disconnect form the server and run the callback once it is done.

  register_default_event_handlers
      $self-&gt;register_default_event_handlers;

    This method sets up the default "DEFAULT EVENT HANDLERS" unless someone
    has already subscribed to the event.

  write
      $self-&gt;write(@str, \&amp;callback);

    This method writes a message to the IRC server. @str will be
    concatenated with " " and "\r\n" will be appended. &amp;callback is called
    once the message is delivered over the stream. The second argument to
    the callback will be an error message: Empty string on success and a
    description on error.

DEFAULT EVENT HANDLERS
  irc_nick
    Used to update the "nick" attribute when the nick has changed.

  irc_notice
    Responds to the server with "QUOTE PASS ..." if the notice contains
    "Ident broken...QUOTE PASS...".

  irc_ping
    Responds to the server with "PONG ...".

  irc_rpl_welcome
    Used to get the hostname of the server. Will also set up automatic PING
    requests to prevent timeout.

  irc_err_nicknameinuse
    Tries to register with the same nick as "nick", only with an extra
    underscore added. The new nick will be stored in "nick".

COPYRIGHT
    This program is free software, you can redistribute it and/or modify it
    under the terms of the Artistic License version 2.0.

AUTHOR
    Marcus Ramberg - "mramberg@cpan.org"

    Jan Henning Thorsen - "jhthorsen@cpan.org"

</pre></body></html>