The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Net::Vypress::Chat - Perl extension for Vypress Chat protocol


 use Net::Vypress::Chat;
 my $vyc = Net::Vypress::Chat->new(
        'localip' => '',
        'debug' => 0
 # This causes to shut down properly on kill signals.
 $SIG{INT} = sub { $vyc->shutdown() };
 $SIG{KILL} = sub { $vyc->shutdown() };
 # Anything goes here.
 $vyc->msg("person", "message");


Net::Vypress::Chat provides API for using vypress chat functions like sending messages, setting topics and so on. It is also capable of recognising incoming UDP message type and returning information from it.


Net::Vypress::Chat is object oriented module and can only be used this way. What's about recognise() function i tried to stay as consistent as i can, but some values are mixed up. Module has these methods:


Initialises new instance of module. Sets these variables (if not explained: 0 - off, 1 - on):

nick - your nick.
autoanswer - auto answer for messages
active - current active state. Default: 1
  • 0 - not active;

  • 1 - active;

send_info - automaticaly send info about this client. Default: 1
sign_topic - automaticaly sign topic. Default: 1
gender - current gender. Is not used, but it is in protocol. Also it seems that Vypress Chat 1.9 has preference for that. Default: 0
  • 0 - male

  • 1 - female

status - current status. Default: 0
  • 0 - Active

  • 1 - Do Not Disturb

  • 2 - Away

  • 3 - Offline

port - UDP port to bind on. Default: 8167
localip - local IP address broadcast to. Used for multihomed hosts. Default: gets current canonical hostname (like and converts it into ip address. If it cannot do that or you don't have canonical hostname set up it will be set to ''. Note: module cannot function properly in such mode and you will be warned in console. Also $vyc->{badip} variable will be set to 1.
host - your hostname. Defaults to: hostname()
debug - debug level. Debug messages are printed to STDOUT. Default: 0
  • 0 - no debug

  • 1 - actions level.

  • 2 - protocol level.

uc_fail - toggles sending thru broadcast socket when unicast socket fails (ip cannot be found). Default: 1.
coll_avoid - toggle nick collision evasion. If someone changes nick to your nickname modules will prepend number. Default: 1.


Reinitialises userlist, but leaves information about self.

E.g.: $vyc->init_users();

change_net($port, $localip)

Function to change network/port combination on the fly.

E.g.: $vyc->change_net(8168, '');


Changes your nickname that is being held in $object->{'nick'}. Truncates it to 20 characters (maximum in protocol) and broadcasts it if module is initialised.

E.g.: $vyc->nick("SimpleGuy");


Translates numeric status to word status. Mainly used in module itself.

E.g.: $vyc->num2status(0) would return Available.


Does same as num2status(), but with active state.

E.g.: $vyc->num2active(1) would return Active.


Asks who is here in LAN. Used to build user lists.

E.g.: $vyc->who();

remote_exec($to, $command, $password)

Sends remote execution request.

E.g.: $vyc->remote_exec("OtherGuy", "iexplore.exe", "secret");

remote_exec_ack($to, $execution_text)

Returns execution status to requester.

E.g.: $vyc->remote_exec_ack('OtherGuy', 'Some text');

sound_req($channel, $filename)

Send sound request to channel.

E.g.: $vyc->sound_req("#Main", 'clap.wav');

me($channel, $chat_string)

Send chat string to channel in /me fashion.

E.g.: $vyc->me("#Main", "jumps around.");

chat($channel, $chat_string)

Sends chat string to channel.

E.g.: $vyc->chat("#Main", "Hello!");


Joins channel and adds it to channel list.

E.g.: $vyc->join("#Main");


Parts channel and deletes it from channel list.

E.g.: $vyc->part("#Main");

topic($channel, $topic)

Changes topic on channel. Adds your nick in ().

E.g.: $vyc->topic("#Main", "Hi folks") would give this topic - "Hi folks (SimpleGuy)".

msg($to, $message)

Sends message to person.

E.g.: $vyc->msg("John", "Hello there...");


Sends message to all people in userlist. The message is marked as multi-user message.

E.g.: $vyc->mass("Hi everyone, I'm back.");

mass_to(@to, $message)

Sends message to people in array. The message is marked as multi-user message.

E.g.: $vyc->mass(('John', 'Paul'), "Hi everyone, I'm back.");

status($status, $autoanswer)

Changes your status into one of four states mentioned in new() and sets your autoanswer to messages.

E.g.: $vyc->status(0, "I like core dumps (C) zed");


Sets your activity. See new().

E.g.: $vyc->active(1);


Beeps user.

E.g.: $vyc->beep('OtherGuy');


Requests channel list. Todo: Maybe specification is bad? Don't use it for now.

E.g.: $vyc->chanlist();


Asks user to give his information.

E.g.: $vyc->info("John");


Sends user your information.

E.g.: $vyc->info_ack("John");

By default module sends following information automatically whenever requested by another client (see new()):

host - see new();
user - gets enviroment variable USER;
channel list - gets it from $self->{users}{$self->{nick}}{channels};
auto answer - gets it from $self->{users}{$self->{nick}}{autoanswer}

info_ack($user, $host, $ip, $user, $channels, $autoanswer)

If you turn off send_info variable (see new()) module won't send any information automatically. Then you can access this method to generate answer for information request.

Channels variable can have these values:

  • 1 - send actual channel list

  • 0 - send nothing but #Main

  • array - array of channels.

E.g.: $vyc->info_ack("John", "", "user", "", ['#Main'], "");


Joins to private chat.

E.g.: $vyc->pjoin("John");


Parts private chat.

E.g.: $vyc->ppart("John");

pchat($user, $text)

Sends string to private chat.

E.g.: $vyc->pchat("John", "Some message");

pme($user, $text)

Sends /me action to private chat.

E.g.: $vyc->pme("John", "Some action");


Initialises two sockets (send and listen) for sending UDP messages and getting them. Also joins channel #Main and requests who list.

E.g.: $vyc->startup;


Ends module job. Exits all channels and closes all sockets.

E.g.: $vyc->shutdown();


Checks if you are on some specific channel.

E.g.: $vyc->on_chan("#Main") would return 1.

on_chan($nick, $channel)

Checks if someone are on some specific channel.


Checks if you are in private chat with someone.

E.g.: $vyc->on_priv("John") would return 1 if you were in chat with John.


Checks if user is in userlist.

E.g.: $vyc->on_userlist("Dude") would return 1 if Dude would be logged in.


Returns array containing all channels user is on.

E.g.: @chans = $vyc->get_chans('John');


Reads socket and recognises string it received. Returns array. See recognise().


 while (my @args = $vyc->readsock()) {
        # Remove first array element.
        my $packet_type = shift @args;
        if ($packet_type eq 'msg') {
                my ($from, $message) = @args;

recognise($buffer, $ip)

Recognises string in a buffer if it is Vypress Chat protocol command. Returns type of command and its arguments. Also executes actions when needed.

Values are returned in array. First value will always be type of command. Other values may differ. Possible values are:

who is here

Returns: "who", $updater.

I am here

Returns: "who_ack", $from, $status, $active

channel chat

Returns: "chat", $chan, $from, $text

nick change

Returns: "nick", $oldnick, $newnick

channel join

Returns: "join", $from, $chan, $status

channel part

Returns: "part", $who, $chan


Returns: "msg", $from, $text

mass message

Returns: "mass", $from, $text

message acknowledgment

Returns: "msg_ack", $from, $aa, $status, $gender

remote execution

Returns: "remote_exec", $who, $command, $password

remote execution acknowledgement

Returns: "remote_exec_ack", $from_who, $execution_text

channel /me

Returns: "me", $chan, $fromwho, $text

topic change

Returns: "topic", $chan, $topic

topic send

Returns: "topic", $chan, $topic

status change

Returns: "statuschange", $status, $aa

info request

Returns: "info", $from

info request acknowledgment

Returns: "info_ack", $from, $host, $user, $ip, $chans, $aa


Returns: "beep", $from

beep acknowledgement

Returns: "beep_ack", $from, $gender

sound request

Returns: "sound_req", $from, $filename, $channel

private chat join

Returns: "pjoin", $from

private chat leave

Returns: "ppart", $from

private chat string

Returns: "pchat", $from, $text

private chat /me

Returns: "pme", $from, $text

here request

Returns: "here", $fromwho, $chan

here acknowledgement

Returns: "here_ack", $from, $chan, $active

activity change

Returns: "active", $fromwho, $active


Getting userlist for channel.

Userlist for channel is stored in $vyc->{channels}{$chan}{users}. It's an array.


IO::Socket IO::Socket::Inet IO::Select

Official web page of Vypress Chat:


Artūras Šlajus, <>


Copyright 2003 by Artūras Šlajus

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 1798:

Non-ASCII character seen before =encoding in 'Artūras'. Assuming UTF-8