Mojo::IRC::UA - IRC Client with sugar on top (DEPRECATED)


  use Mojo::IRC::UA;
  my $irc = Mojo::IRC::UA->new;


Mojo::IRC::UA is a module which extends Mojo::IRC with methods that can track changes in state on the IRC server.

This module is DEPRECATED and should no longer be used.


Mojo::IRC::UA inherits all attributes from Mojo::IRC and implements the following new ones.


  $int = $self->op_timeout;
  $self = $self->op_timeout($int);

Max number of seconds to wait for a response from the IRC server.


Mojo::IRC::UA inherits all events from Mojo::IRC and implements the following new ones.


Mojo::IRC::UA inherits all methods from Mojo::IRC and implements the following new ones.


  $self = $self->channels(sub { my ($self, $err, $channels) = @_; });

Will retrieve available channels on the IRC server. $channels has this structure on success:

    "#convos" => {n_users => 4, topic => "[+nt] some cool topic"},

NOTE: This might take a long time, if the server has a lot of channels.


  $self = $self->channel_topic($channel, $topic, sub { my ($self, $err) = @_; });
  $self = $self->channel_topic($channel, sub { my ($self, $err, $res) = @_; });

Used to get or set topic for a channel. $res is a hash with a key "topic" which holds the current topic.


  $self = $self->channel_users($channel, sub { my ($self, $err, $users) = @_; });

This can retrieve the users in a channel. $users contains this structure:

    jhthorsen => {mode => "o"},
    Superman  => {mode => ""},

This method is EXPERIMENTAL and can change without warning.


  $self = $self->join_channel($channel => sub { my ($self, $err, $info) = @_; });

Used to join an IRC channel. $err will be false (empty string) on a successful join. $info will contain information about the joined channel:

    name     => "#channel_name",
    topic    => "some cool topic",
    topic_by => "jhthorsen",
    users    => {
      jhthorsen => {mode => "@"},
      Superman  => {mode => ""},

"name" in $info holds the actual channel name that is joined. This will not be the same as $channel in case of "ERR_LINKCHANNEL" (470) events, where you are automatically redirected to another channel.

NOTE! This method will fail if the channel is already joined. Unfortunately, the way it will fail is simply by not calling the callback. This should be fixed - Just don't know how yet.


  $self = $self->kick("#channel superman", sub { my ($self, $err, $res) = @_; });

Used to kick a user. $res looks like this:

  {reason => "you don't behave"}


  $self = $self->mode(sub { my ($self, $err, $mode) = @_; });
  $self = $self->mode("-i", sub { my ($self, $err, $mode) = @_; });
  $self = $self->mode("#channel +k secret", sub { my ($self, $err, $mode) = @_; });

This method is used to get or set a user mode or set a channel mode.

$mode is EXPERIMENTAL, but holds a hash, with "mode" as key.

Note that this method seems to be unstable. Working on a fix:


  $self = $self->nick($nick => sub { my ($self, $err) = @_; });
  $self = $self->nick(sub { my ($self, $err, $nick) = @_; });

Used to set or get the nick for this connection.

Setting the nick will change "nick" after the nick is actually changed on the server.


  $self = $self->part_channel($channel => sub { my ($self, $err) = @_; });

Used to part/leave a channel.


  $self = $self->whois($target, sub { my ($self, $err, $info) = @_; });

Used to retrieve information about a user. $info contains this information on success:

    channels => {"#convos => {mode => "@"}],
    host     => "",
    idle_for => 17454,
    name     => "Jan Henning Thorsen",
    nick     => "batman",
    server   => "hybrid8.debian.local",
    user     => "jhthorsen",


Copyright (C) 2014, Jan Henning Thorsen

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


Jan Henning Thorsen -