Net::MQ...nstants(3)

πŸ“¦ version 1.163170, in alpine 3.24

πŸ’– 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 $length and 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 $data starting 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 $data starting 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 $data starting 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 the message_type value 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 the connect_return_code value you gave it. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Mark Hindess <soft-cpan@temporalanomaly.com> β€” the legend himself, we love him, we thank him πŸ’–

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