ANYEVENT-MQTT-SUB(1)
okay bestie, welcome to the ANYEVENT-MQTT-SUB(1) manual page β yes, from the User Contributed Perl Documentation corner of the universe β and it's all about anyevent-mqtt-sub, a Perl script that subscribes to MQTT topics. πβ¨
π NAME π
anyevent-mqtt-sub β Perl script for subscribing to an MQTT topic. no cap. π«Ά
π VERSION π
version 1.212810 β that's the version, bestie. π
π¦ SYNOPSIS π¦
anyevent-mqtt-sub [options] topic1 [topic2] [topic3] ...
β¨ DESCRIPTION β¨
This script subscribes to one or more MQTT topics and prints any messages that it receives to stdout. It's giving simple, iconic, and useful. π
π OPTIONS π
okay so here are all the flags β every single one, because we don't skip the boring parts in this group chat. π
-helpβ Print a brief help message. cute. β¨-manβ Print the manual page. (you're literally in one right now lol) π-host A.B.C.Dβ The host running the MQTT service. The default is127.0.0.1. π-port NNNNNβ The port of the running MQTT service. The default is1883. π-client-id STRINGβ The client id to use in the connect message. The default is'NetMQTTpm'followed by the process id of the process. For maximum compatibility, this should be up to 23 characters and only use the charactersA-Z,a-z, and0-9. π³-qos Nβ The QoS level for the published message. The default is0("MQTT_QOS_AT_MOST_ONCE"). π¨-verboseβ Include more verbose output. Without this option the script only outputs errors and received messages one per line in the formtopic message. With one-verboseoption, publish messages are printed in a form of a summary of the header fields and the payload in hex dump and text form. With two-verboseoptions, summaries are printed for all messages sent and received. ππ₯-keepalive NNNβ The keep alive timer value. Defaults to120seconds. For simplicity, it is also currently used as the connection/subscription timeout. β²οΈ-count NNNβ Read the specified number of MQTT messages and then exit. Default is0β read forever. π-oneor-1β Short for-count 1. Read one message and exit. βοΈ--no-retainβ Ignore retained messages. That is, wait for new messages rather than processing existing retained messages. π«--code CODEβ UseCODEfor callback. The caller is responsible for ensuring that the code to be executed is safe β i.e. notsystem('rm -rf /');. The code will be called with the following arguments in@_:- The topic of the received message.
- The message payload.
- The
Net::MQTT::Messageobject for the message. - A condvar that can be emitted to quit the subscribe loop.
- The
AnyEvent::MQTTobject. - An empty hash reference that can be used as a stash.
For example:
my ($topic, $payload, $message, $quitcv, $mqtt, $stash) = @_;
print STDERR $topic, ': ', $payload, "\n";
$quitcv->send if ($stash->{'count'}++ > 10);
If a callback is provided with this option then the builtin callback is no longer called. π«Ά
π SEE ALSO π
AnyEvent::MQTT(3)β go read it, bestie. π
π DISCLAIMER π
This is not official IBM code. The author works for IBM but wrote this in spare time (with permission) for fun. no cap. π
π§ AUTHOR π§
Mark Hindess β <soft-cpan@temporalanomaly.com> β iconic. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2014 by Mark Hindess. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π
mwah π β this page is from perl v5.42.2, dated 2026-04-15, and it's the ANYEVENT-MQTT-SUB(1) manual. bye bestie! πΈπ
π¦ where this page comes from
- alpine 3.24: perl-anyevent-mqtt-doc 1.212810-r2 Β· 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