Net::DB...terator(3)
πΈ NAME πΈ
okay so bestie, this is the Net::DB...terator(3) page from User Contributed Perl Documentation, and it's literally all about Net::DBus::Binding::Iterator β Reading and writing message parameters. It's giving βI handle D-Bus message fieldsβ energy. π
β¨ SYNOPSIS β¨
π Creating a new message
my $msg = new Net::DBus::Binding::Message::Signal;
my $iterator = $msg->iterator;
$iterator->append_boolean(1);
$iterator->append_byte(123);
π₯ Reading from a message
my $msg = ...get it from somewhere...
my $iter = $msg->iterator();
my $i = 0;
while ($iter->has_next()) {
$iter->next();
$i++;
if ($i == 1) {
my $val = $iter->get_boolean();
} elsif ($i == 2) {
my $val = $iter->get_byte();
}
}
π«Ά DESCRIPTION π«Ά
Provides an iterator for reading or writing message fields. This module provides a Perl API to access the dbus_message_iter_XXX methods in the C API.
π¨ Real talk, bestie: the array and dictionary types are not yet supported, and there are bugs in the Quad support (ie it always returns -1!). So don't come for me when that happens, okay? π
π METHODS π
$res = $iter->has_next()β determines if there are any more fields in the message iterator to be read. Returns a positive value if there are more fields, zero otherwise.$success = $iter->next()β skips the iterator onto the next field in the message. Returns a positive value if the current field pointer was successfully advanced, zero otherwise.my $val = $iter->get_boolean()/$iter->append_boolean($val);β read or write a boolean value from/to the message iterator.my $val = $iter->get_byte()/$iter->append_byte($val);β read or write a single byte value from/to the message iterator.my $val = $iter->get_string()/$iter->append_string($val);β read or write a UTF-8 string value from/to the message iterator.my $val = $iter->get_object_path()/$iter->append_object_path($val);β read or write a UTF-8 string value, whose contents is a valid object path, from/to the message iterator.my $val = $iter->get_signature()/$iter->append_signature($val);β read or write a UTF-8 string, whose contents is a valid type signature, value from/to the message iterator.my $val = $iter->get_int16()/$iter->append_int16($val);β read or write a signed 16 bit value from/to the message iterator.my $val = $iter->get_uint16()/$iter->append_uint16($val);β read or write an unsigned 16 bit value from/to the message iterator.my $val = $iter->get_int32()/$iter->append_int32($val);β read or write a signed 32 bit value from/to the message iterator.my $val = $iter->get_uint32()/$iter->append_uint32($val);β read or write an unsigned 32 bit value from/to the message iterator.my $val = $iter->get_int64()/$iter->append_int64($val);β read or write a signed 64 bit value from/to the message iterator. An error will be raised if this build of Perl does not support 64 bit integers.my $val = $iter->get_uint64()/$iter->append_uint64($val);β read or write an unsigned 64 bit value from/to the message iterator. An error will be raised if this build of Perl does not support 64 bit integers.my $val = $iter->get_double()/$iter->append_double($val);β read or write a double precision floating point value from/to the message iterator.my $val = $iter->get_unix_fd()/$iter->append_unix_fd($val);β read or write aunix_fdvalue from/to the message iterator.my $value = $iter->get()/my $value = $iter->get($type);β get the current value pointed to by this iterator. If the optional$typeparameter is supplied, the wire type will be compared with the desired type & a warning output if they differ. The$typevalue must be one of the"Net::DBus::Binding::Message::TYPE*"constants.my $hashref = $iter->get_dict()β if the iterator currently points to a dictionary value, unmarshalls and returns the value as a hash reference.my $hashref = $iter->get_array()β if the iterator currently points to an array value, unmarshalls and returns the value as an array reference.my $hashref = $iter->get_variant()β if the iterator currently points to a variant value, unmarshalls and returns the value contained in the variant.my $hashref = $iter->get_struct()β if the iterator currently points to a struct value, unmarshalls and returns the value as an array reference. The values in the array correspond to members of the struct.$iter->append($value)/$iter->append($value, $type)β appends a value to the message associated with this iterator. The value is marshalled into wire format, according to the following rules.- If the
$valueis an instance ofNet::DBus::Binding::Value, the embedded data type is used. - If the
$typeparameter is supplied, that is taken to represent the data type. The type must be one of the"Net::DBus::Binding::Message::TYPE_*"constants. - Otherwise, the data type is chosen to be a string, dict or array according to the perl data types
SCALAR,HASHorARRAY.
- If the
my $type = $iter->guess_type($value)β make a best guess at the on the wire data type to use for marshalling$value. If the value is a hash reference, the dictionary type is returned; if the value is an array reference the array type is returned; otherwise the string type is returned.my $sig = $iter->format_signature($type)β given a data type representation, construct a corresponding signature string.$iter->append_array($value, $type)β append an array of values to the message. The$valueparameter must be an array reference, whose elements all have the same data type specified by the$typeparameter.$iter->append_struct($value, $type)β append a struct to the message. The$valueparameter must be an array reference, whose elements correspond to members of the structure. The$typeparameter encodes the type of each member of the struct.$iter->append_dict($value, $type)β append a dictionary to the message. The$valueparameter must be a hash reference. The$typeparameter encodes the type of the key and value of the hash.$iter->append_variant($value)β append a value to the message, encoded as a variant type. The$valuecan be of any type, however, the variant will be encoded as either a string, dictionary or array according to the rules of theguess_typemethod.my $type = $iter->get_arg_typeβ retrieves the type code of the value pointing to by this iterator. The returned code will correspond to one of the constants"Net::DBus::Binding::Message::TYPE_*".my $type = $iter->get_element_typeβ if the iterator points to an array, retrieves the type code of array elements. The returned code will correspond to one of the constants"Net::DBus::Binding::Message::TYPE_*".
π AUTHOR π
Daniel P. Berrange
π COPYRIGHT π
Copyright (C) 2004-2011 Daniel P. Berrange
π SEE ALSO π
Net::DBus::Binding::Message
and that's the whole page, bestie π«Ά β this one is from perl v5.42.0, dated 2019-12-17. mwah π
π¦ 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