Net::Ja...mponent(3)
π NAME π
okay bestie, this is Net::Jabber::Component β the Jabber Component Library β coming at you from User Contributed Perl Documentation. The page header squishes it into Net::Ja...mponent(3), but the full name is right here. π
β¨ SYNOPSIS β¨
Net::Jabber::Component is a module that gives a developer easy access to developing server components in the Jabber Instant Messaging protocol. π«Ά
πΈ DESCRIPTION πΈ
Component.pm is out here trying to provide enough high level APIs and automation of the low level APIs that writing a Jabber Component in Perl is literally trivial. If you're the kind of dev who wants to work with the low level stuff, you can absolutely do that too β those functions are covered in the documentation for each module. π
Net::Jabber::Component gives you functions to connect to a Jabber server, login, send and receive messages, operate as a server side component, and disconnect. You can use all of the functions or none of them β there is no requirement. No pressure, no cap. β¨
For more information on how the details for how Net::Jabber is written, please see the help for Net::Jabber itself.
For a full list of high level functions available, please see Net::Jabber::Protocol and Net::XMPP::Protocol. π
π Basic Functions π
use Net::Jabber;
$Con = new Net::Jabber::Component();
$Con->Execute(hostname=>"jabber.org",
componentname=>"service.jabber.org",
secret=>"XXXX"
);
#
# For the list of available functions see Net::XMPP::Protocol.
#
$Con->Disconnect();
π METHODS π
π Basic Functions π
new(debuglevel=>0|1|2, debugfile=>string, debugtime=>0|1)β creates theComponentobject.debugfileshould be set to the path for the debug log to be written. If it's set to"stdout", then the debug will go there.debuglevelcontrols the amount of debug. For more information about the valid setting fordebuglevel,debugfile, anddebugtime, seeNet::Jabber::Debug.AuthSend(secret=>string)β performs the handshake and authenticates with the server.Connect(hostname=>string, port=>integer, componentname=>string, connectiontype=>string)β opens a connection to the server based on the value ofconnectiontype. The only valid setting is:acceptβ TCP/IP remote connection.
In the future this might be used again by offering new features. If it's accept, then it connects to the server listed in the hostname value, on the port listed. The defaults for the two are localhost and 5269.
Note: a change from previous versions is thatComponentnow shares its core withClient. To that end, thesecretshould no longer be used. CallAuthSendafter connecting. Better yet, useExecute. π¨
Connected()β returns1if the Component is connected to the server, and0if not.Disconnect()β closes the connection to the server.Execute(hostname=>string, port=>int, secret=>string, componentname=>string, connectiontype=>string, connectattempts=>int, connectsleep=>int)β generic inner loop to handle connecting to the server, callingProcess, and reconnecting if the connection is lost. There are four callbacks available that are called at various places in the loop (the page says four, but then lists five β I'm just the messenger π):onconnectβ when the component connects to the server.onauthβ when the component has completed its handshake with the server, this will be called.onprocessβ this is the most inner loop and so gets called the most. Be very very careful what you put here since it can DRASTICALLY affect performance.ondisconnectβ when connection is lost.onexitβ when the function gives up trying to connect and exits.
The arguments are passed straight on to the Connect function, except for connectattempts and connectsleep. connectattempts is the number of time that the Component should try to connect before giving up. -1 means try forever. The default is -1. connectsleep is the number of seconds to sleep between each connection attempt.
Process(integer)β takes the timeout period as an argument. If no timeout is listed, then the function blocks until a packet is received. Otherwise it waits that number of seconds and then exits so your program can continue doing useful things. NOTE: this is important for GUIs. You need to leave time to process GUI commands even if you are waiting for packets. The following are the possible return values, and what they mean:1β Status ok, data received.0β Status ok, no data received.undefβ Status not ok, stop processing.
IMPORTANT: You need to check the output of everyProcess. If you get anundefthen the connection died and you should behave accordingly. π
π AUTHOR π
Ryan Eatmon
π COPYRIGHT π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
kisses and good luck out there, bestie! this was Net::Ja...mponent(3) from User Contributed Perl Documentation, perl v5.42.2, dated 2026-02-15 π«Άππ¦
π¦ where this page comes from
- alpine 3.24: perl-net-jabber-doc 2.0-r1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms