Net::Async::XMPP(3)
β¨ Net::Async::XMPP β¨
okay so bestie, picture this: an asynchronous XMPP client β like, it does its whole chatting thing without ever blocking your event loop, which is the vibe. It's built on top of Protocol::XMPP and IO::Async::Protocol::Stream, and honestly? It ate. π
This is the Net::Async::XMPP page from the User Contributed Perl Documentation, and it's giving very much "gateway to the good stuff" β the real deets live in the subclasses, but let's get you oriented first. π¦
πΈ VERSION πΈ
version 0.002 β yes queen, we're on 0.002. Small number, big energy. β¨
π SYNOPSIS π
okay so here's the whole setup, and ngl it's kind of iconic β you make a loop, you make a client, you hand it a bunch of callbacks, you add it to the loop, you log in, you run. Periodt. π
use IO::Async::Loop;
use Net::Async::XMPP;
my $loop = IO::Async::Loop->new;
my $client = Net::Async::XMPP::Client->new(
on_message => sub {
my ($client, $msg) = @_;
warn "Message from " . $msg->from . " subject " . $msg->subject . " body " . $msg->body;
$msg->reply(
body => 'Message received: ' . $msg->body
);
},
on_contact_request => sub {
my ($client, $contact) = @_;
warn "Contact request from " . $contact->jid;
},
on_presence => sub {
my ($client, $contact) = @_;
warn "Had a presence update from " . $contact->jid;
},
);
$loop->add($client);
$client->login(
jid => 'user@example.com',
password => $ENV{NET_ASYNC_XMPP_PASSWORD},
);
$loop->run;
so yeah π β on_message fires and you get the $msg, and you can peek at ->from, ->subject, ->body, and then ->reply(body => ...) right back at them. on_contact_request hands you a $contact and you can warn about ->jid. on_presence does the same presence-update thing. Then $loop->add($client), $client->login(jid => ..., password => ...), and $loop->run. That's it, that's the whole ritual. Notice the password comes from $ENV{NET_ASYNC_XMPP_PASSWORD} β keep your secrets in the environment, bestie, not in your source. π
π§ DESCRIPTION π§
fr fr, this page is mostly a signpost. If you want the actual details, go look at the Net::Async::XMPP::Client or Net::Async::XMPP::Server subclasses β they're the main characters here, and I'm just the group chat pointing you at them. π«Ά
π AUTHOR π
Tom Molesworth <cpan@entitymodel.com> β the one who made it happen. π
π CONTRIBUTORS π
with thanks to the following for contribution β genuinely obsessed with these people, no cap:
- Arthur Axel "fREW" Schmidt for testing, documentation, pointing out some of my mistakes, that sort of thing π (we love a person who catches the oopses)
- Paul "LeoNerd" Evans for adding Futures to
IO::Async(and writing both in the first place) β like, literally built the whole foundation, king behaviour π - Matt Trout for testing early versions β
π LICENSE π
Copyright Tom Molesworth 2010-2014. Licensed under the same terms as Perl itself.
so yeah, that's the legal bit β same terms as Perl itself, periodt. π
π cute little sign-off: this beauty isperl v5.42.2, dated2026-02-15, straight from theNet::Async::XMPP(3)page in the User Contributed Perl Documentation. go forth and be asynchronous, bestie. π¦β¨πΈ
π¦ where this page comes from
- alpine 3.24: perl-net-async-xmpp-doc 0.003-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms