Net::MQ...nstants(3)
π Net::MQTT::Constants β the perl page that got its name squished π
okay so real talk, this one's filed under User Contributed Perl Documentation and the actual page title is Net::MQTT::Constants β the header just clipped it to Net::MQ...nstants(3) because terminals are dramatic. anyway. hi bestie π«Ά
β¨ NAME β¨
Net::MQTT::Constants β it's the module that exports all the constants for the MQTT protocol. that's the whole job. it does the job. π
π VERSION π
version 1.163170 β yes that number is real, yes it's giving timestamp, no we're not questioning it β
π¦ SYNOPSIS π¦
one line. one iconic line:
use Net::MQTT::Constants;
that's it. you're in. you're so in. π
πΈ DESCRIPTION πΈ
Module to export constants for the MQTT protocol. literally what it says on the tin, no cap. π
π₯ FUNCTIONS π₯
okay this is the main character section, buckle up. every single one of these bad boys does byte-level work for you so you don't have to, and the offset refs get bumped along the way β yes, they mutate, that's the whole bit, don't come for me π
decode_remaining_length( $data, \$offset )β works out the "remaining length" from the bytes in$data, starting at the offset it reads from that scalar reference. and then? the offset reference gets incremented by however many bytes it chewed through. it's efficient. it's tidy. we stan. πencode_remaining_length( $length )β takes$lengthand calculates the "remaining length" bytes from it, then hands you back those packed bytes as a string. reverse uno card, slayed. β¨decode_byte( $data, \$offset )β unpacks one single byte out of$datastarting at the offset from the scalar reference, and returns it. then bumps the offset reference by the number of bytes processed. one byte. one vibe. π₯encode_byte( $byte )β returns a packed byte. short king, absolutely no notes. π§decode_short( $data, \$offset )β unpacks a short (that's two bytes, bestie) out of$datastarting at the offset read from the scalar reference and returns it. offset reference gets incremented by the bytes processed afterwards. πencode_short( $short )β returns a packed short (two bytes). two whole bytes of pure potential. π«decode_string( $data, \$offset )β unpacks a string out of$datastarting at the offset read from the scalar reference and returns it. and what's a string here? a short length followed by that many bytes. the offset reference then gets incremented by the number of bytes processed. it's giving structure. it's giving protocol. πencode_string( $string )β returns a packed string β that's the length as a short, and then the bytes of the string right after it. β¨qos_string( $qos_value )β returns a string describing the QoS value you gave it. π¦message_type_string( $message_type_value )β returns a string describing themessage_typevalue you gave it. πΈdump_string( $data )β returns a string representation of arbitrary data. if it's all printable characters you get it as a plain string; otherwise you get a hex dump. bestie does both. versatile icon. πconnect_return_code_string( $return_code_value )β returns a string describing theconnect_return_codevalue you gave it. π«Ά
π AUTHOR π
Mark Hindess <soft-cpan@temporalanomaly.com> β the legend himself, we love him, we thank him π
π 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. free software fr fr, go wild, but keep the terms. π
ngl the "same terms as the Perl 5 programming language system itself" bit is the license, so read it properly before you go shipping things, k? π
and that's the whole page!! sign-off time: this was perl v5.42.2, dated 2026-02-15, page name Net::MQ...nstants(3) β go forth and encode your little bytes, mwah πβ¨π
π¦ where this page comes from
- alpine 3.24: perl-net-mqtt-doc 1.163170-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