Net::DB...:Message(3)
π Net::DBus::Binding::Message β the base class for messages, bestie π
okay so real talk, this page is Net::DB...:Message(3) from the User Contributed Perl Documentation, and it's basically the mother of all message objects. she's the blueprint, the blueprint that never gets instantiated directly, iykyk π
β¨ NAME β¨
Net::DBus::Binding::Message β the base class for messages. that's it, that's her whole job. queen of being a foundation π
πΈ SYNOPSIS πΈ
here's the vibe β sending a message, in all her glory:
my $msg = new Net::DBus::Binding::Message::Signal;
my $iterator = $msg->iterator;
$iterator->append_byte(132);
$iterator->append_int32(14241);
$connection->send($msg);
look at her go. no notes. π₯
π¦ DESCRIPTION π¦
okay so this class is the base class for all the different kinds of message that can be sent and received on the bus. she's the parent, the origin story, the main character energy of the whole message family.
but here's the thing β and this is important, bestie β instances of this class are never instantiated directly. never ever. instead you use one of the four sub-types:
Net::DBus::Binding::Message::SignalNet::DBus::Binding::Message::MethodCallNet::DBus::Binding::Message::MethodReturnNet::DBus::Binding::Message::Error
those are the ones you actually build. this one's just the blueprint. periodt. π
π CONSTANTS π
these constants live in this module, but heads up β they are not exported into the caller's namespace, so you gotta reference them with their fully qualified package names. no shortcuts, no import, just the full name or nothing. π«Ά
TYPE_ARRAYβ the signature value for the array data typeTYPE_BOOLEANβ the signature value for the boolean data typeTYPE_BYTEβ the signature value for the byte data typeTYPE_DICT_ENTRYβ the signature value for the dictionary entry data typeTYPE_DOUBLEβ the signature value for the IEEE double precision floating point data typeTYPE_INT16β the signature value for the signed 16 bit integer data typeTYPE_INT32β the signature value for the signed 32 bit integer data typeTYPE_INT64β the signature value for the signed 64 bit integer data typeTYPE_OBJECT_PATHβ the signature value for the object path data typeTYPE_STRINGβ the signature value for the UTF-8 string data typeTYPE_SIGNATUREβ the signature value for the signature data typeTYPE_STRUCTβ the signature value for the struct data typeTYPE_UINT16β the signature value for the unsigned 16 bit integer data typeTYPE_UINT32β the signature value for the unsigned 32 bit integer data typeTYPE_UINT64β the signature value for the unsigned 64 bit integer data typeTYPE_VARIANTβ the signature value for the variant data typeTYPE_UNIX_FDβ the signature value for the unix file descriptor data type
that's the whole squad. seventeen icons, all accounted for. π§
π METHODS π
π my $msg = Net::DBus::Binding::Message->new(message => $rawmessage);
creates a new message object, initializing it with the underlying C message object given by the "message" object.
ok so this one is intended for internal use only β do not come for her. instead, refer to one of the four sub-types of this class for your specific message type. fr fr, don't @ me if you use this directly. π
π my $type = $msg->get_type
gets the type code for this message. whatever comes back corresponds to one of the four "Net::DBus::Binding::Message::MESSAGE_TYPE_*" constants. iykyk.
π my $interface = $msg->get_interface
retrieves the name of the interface targeted by this message β and it might be an empty string if there's no applicable interface for this message. no interface, no problem. π
π my $path = $msg->get_path
retrieves the object path associated with the message. possibly an empty string if there's no applicable object for this message. same deal.
π my $name = $msg->get_destination
retrieves the unique or well-known bus name for the client that's intended to be the recipient of the message. possibly returns an empty string if the message is being broadcast to all clients. everybody gets a slice π
π my $name = $msg->get_sender
retrieves the unique name of the client sending the message. that's the sender, the one who sent it, the origin. π
π my $serial = $msg->get_serial
retrieves the unique serial number of this message. and it's guaranteed unique for as long as the connection over which the message was sent remains open. may return zero if the message is yet to be sent β so a zero means "not yet, babe". β
π my $name = $msg->get_member
for method calls, retrieves the name of the method to be invoked. for signals, retrieves the name of the signal. dual purpose icon. π
π my $sig = $msg->get_signature
retrieves a string representing the type signature of the values packed into the body of the message. basically the receipts for what's inside. π
π $msg->set_sender($name)
sets the name of the client sending the message. and the name must be the unique name of the client β non-negotiable, bestie.
π $msg->set_destination($name)
sets the name of the intended recipient of the message. this is typically used for signals to switch them from broadcast to unicast. glow-up from "everyone" to "just you" π
π my $iterator = $msg->iterator;
retrieves an iterator you can use for reading or writing fields of the message. the returned object is an instance of the "Net::DBus::Binding::Iterator" class. she's the one who handles the actual touching. π¦
π $boolean = $msg->get_no_reply()
gets the flag that says whether the message is expecting a reply to be sent.
π $msg->set_no_reply($boolean)
toggles that flag β the one saying whether the message is expecting a reply to be sent. all method call messages expect a reply by default. by toggling this flag you reduce communication latency by removing the need for the client to wait. speedrun strats π₯
π my @values = $msg->get_args_list
de-marshalls all the values in the body of the message, using the message signature to identify data types. the values come back as a list. unpacking the haul π
π $msg->append_args_list(@values)
appends a set of values to the body of the message. values get encoded as either a string, list or dictionary as appropriate to their Perl data type. for more specific data typing needs, use the Net::DBus::Binding::Iterator object instead. no cap, that's the move. π―
π AUTHOR π
Daniel P. Berrange β the legend, the icon, the moment. π
π COPYRIGHT π
Copyright (C) 2004-2011 Daniel P. Berrange
π SEE ALSO π
go read these next, bestie, they're all connected:
Net::DBus::Binding::ServerNet::DBus::Binding::ConnectionNet::DBus::Binding::Message::SignalNet::DBus::Binding::Message::MethodCallNet::DBus::Binding::Message::MethodReturnNet::DBus::Binding::Message::Error
and that's the whole page, bestie β you ate that π β¨
this lil masterpiece is perl v5.42.0, dated 2019-12-17, and appears on page Net::DB...:Message(3). go forth and send messages responsibly π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-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