{"id":7364,"date":"2022-12-20T19:37:50","date_gmt":"2022-12-20T22:37:50","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/netdbusbindingiterator-man3\/"},"modified":"2022-12-20T19:37:50","modified_gmt":"2022-12-20T22:37:50","slug":"netdbusbindingiterator-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/netdbusbindingiterator-man3\/","title":{"rendered":"Net::DBus::Binding::Iterator (man3)"},"content":{"rendered":"<h1 align=\"center\">Net::DBus::Binding::Iterator<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Net::DBus::Binding::Iterator \u2212 Reading and writing message parameters<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Creating a new message<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">my $msg = new Net::DBus::Binding::Message::Signal; <br \/> my $iterator = $msg\u2212>iterator; <br \/> $iterator\u2212>append_boolean(1); <br \/> $iterator\u2212>append_byte(123);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Reading from a message<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">my $msg = &#8230;get it from somewhere&#8230; <br \/> my $iter = $msg\u2212>iterator(); <br \/> my $i = 0; <br \/> while ($iter\u2212>has_next()) { <br \/> $iter\u2212>next(); <br \/> $i++; <br \/> if ($i == 1) { <br \/> my $val = $iter\u2212>get_boolean(); <br \/> } elsif ($i == 2) { <br \/> my $val = $iter\u2212>get_byte(); <br \/> } <br \/> }<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Provides an iterator for reading or writing message fields. This module provides a Perl <small>API<\/small> to access the dbus_message_iter_XXX methods in the C <small>API.<\/small> The array and dictionary types are not yet supported, and there are bugs in the Quad support (ie it always returns \u22121!).<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">$res = $iter\u2212><b>has_next()<\/b><\/p>\n<p style=\"margin-left:17%;\">Determines if there are any more fields in the message itertor to be read. Returns a positive value if there are more fields, zero otherwise.<\/p>\n<p style=\"margin-left:11%;\">$success = $iter\u2212><b>next()<\/b><\/p>\n<p style=\"margin-left:17%;\">Skips the iterator onto the next field in the message. Returns a positive value if the current field pointer was successfully advanced, zero otherwise.<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_boolean()<\/b> <br \/> $iter\u2212>append_boolean($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a boolean value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_byte()<\/b> <br \/> $iter\u2212>append_byte($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a single byte value from\/to the message iterator.<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_string()<\/b> <br \/> $iter\u2212>append_string($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a <small>UTF\u22128<\/small> string value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_object_path()<\/b> <br \/> $iter\u2212>append_object_path($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a <small>UTF\u22128<\/small> string value, whose contents is a valid object path, from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_signature()<\/b> <br \/> $iter\u2212>append_signature($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a <small>UTF\u22128<\/small> string, whose contents is a valid type signature, value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_int16()<\/b> <br \/> $iter\u2212>append_int16($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a signed 16 bit value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_uint16()<\/b> <br \/> $iter\u2212>append_uint16($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write an unsigned 16 bit value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_int32()<\/b> <br \/> $iter\u2212>append_int32($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a signed 32 bit value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_uint32()<\/b> <br \/> $iter\u2212>append_uint32($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write an unsigned 32 bit value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_int64()<\/b> <br \/> $iter\u2212>append_int64($val);<\/p>\n<p style=\"margin-left:17%;\">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<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_uint64()<\/b> <br \/> $iter\u2212>append_uint64($val);<\/p>\n<p style=\"margin-left:17%;\">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<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_double()<\/b> <br \/> $iter\u2212>append_double($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a double precision floating point value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $val = $iter\u2212><b>get_unix_fd()<\/b> <br \/> $iter\u2212>append_unix_fd($val);<\/p>\n<p style=\"margin-left:17%;\">Read or write a unix_fd value from\/to the message iterator<\/p>\n<p style=\"margin-left:11%;\">my $value = $iter\u2212><b>get()<\/b> <br \/> my $value = $iter\u2212>get($type);<\/p>\n<p style=\"margin-left:17%;\">Get the current value pointed to by this iterator. If the optional $type parameter is supplied, the wire type will be compared with the desired type &#038; a warning output if their differ. The $type value must be one of the &#8220;Net::DBus::Binding::Message::TYPE*&#8221; constants.<\/p>\n<p style=\"margin-left:11%;\">my $hashref = $iter\u2212><b>get_dict()<\/b><\/p>\n<p style=\"margin-left:17%;\">If the iterator currently points to a dictionary value, unmarshalls and returns the value as a hash reference.<\/p>\n<p style=\"margin-left:11%;\">my $hashref = $iter\u2212><b>get_array()<\/b><\/p>\n<p style=\"margin-left:17%;\">If the iterator currently points to an array value, unmarshalls and returns the value as a array reference.<\/p>\n<p style=\"margin-left:11%;\">my $hashref = $iter\u2212><b>get_variant()<\/b><\/p>\n<p style=\"margin-left:17%;\">If the iterator currently points to a variant value, unmarshalls and returns the value contained in the variant.<\/p>\n<p style=\"margin-left:11%;\">my $hashref = $iter\u2212><b>get_struct()<\/b><\/p>\n<p style=\"margin-left:17%;\">If the iterator currently points to an struct value, unmarshalls and returns the value as a array reference. The values in the array correspond to members of the struct.<\/p>\n<p style=\"margin-left:11%;\">$iter\u2212>append($value) <br \/> $iter\u2212>append($value, $type)<\/p>\n<p style=\"margin-left:17%;\">Appends a value to the message associated with this iterator. The value is marshalled into wire format, according to the following rules.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">If the $value is an instance of Net::DBus::Binding::Value, the embedded data type is used.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">If the $type parameter is supplied, that is taken to represent the data type. The type must be one of the &#8220;Net::DBus::Binding::Message::TYPE_*&#8221; constants.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Otherwise, the data type is chosen to be a string, dict or array according to the perl data types <small>SCALAR, HASH<\/small> or <small>ARRAY.<\/small><\/p>\n<p style=\"margin-left:11%;\">my $type = $iter\u2212>guess_type($value)<\/p>\n<p style=\"margin-left:17%;\">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.<\/p>\n<p style=\"margin-left:11%;\">my $sig = $iter\u2212>format_signature($type)<\/p>\n<p style=\"margin-left:17%;\">Given a data type representation, construct a corresponding signature string<\/p>\n<p style=\"margin-left:11%;\">$iter\u2212>append_array($value, $type)<\/p>\n<p style=\"margin-left:17%;\">Append an array of values to the message. The $value parameter must be an array reference, whose elements all have the same data type specified by the $type parameter.<\/p>\n<p style=\"margin-left:11%;\">$iter\u2212>append_struct($value, $type)<\/p>\n<p style=\"margin-left:17%;\">Append a struct to the message. The $value parameter must be an array reference, whose elements correspond to members of the structure. The $type parameter encodes the type of each member of the struct.<\/p>\n<p style=\"margin-left:11%;\">$iter\u2212>append_dict($value, $type)<\/p>\n<p style=\"margin-left:17%;\">Append a dictionary to the message. The $value parameter must be an hash reference.The $type parameter encodes the type of the key and value of the hash.<\/p>\n<p style=\"margin-left:11%;\">$iter\u2212>append_variant($value)<\/p>\n<p style=\"margin-left:17%;\">Append a value to the message, encoded as a variant type. The $value can be of any type, however, the variant will be encoded as either a string, dictionary or array according to the rules of the &#8220;guess_type&#8221; method.<\/p>\n<p style=\"margin-left:11%;\">my $type = $iter\u2212>get_arg_type<\/p>\n<p style=\"margin-left:17%;\">Retrieves the type code of the value pointing to by this iterator. The returned code will correspond to one of the constants &#8220;Net::DBus::Binding::Message::TYPE_*&#8221;<\/p>\n<p style=\"margin-left:11%;\">my $type = $iter\u2212>get_element_type<\/p>\n<p style=\"margin-left:17%;\">If the iterator points to an array, retrieves the type code of array elements. The returned code will correspond to one of the constants &#8220;Net::DBus::Binding::Message::TYPE_*&#8221;<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Daniel P. Berrange<\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright (C) 2004\u22122011 Daniel P. Berrange<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Net::DBus::Binding::Message<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Net::DBus::Binding::Iterator \u2212 Reading and writing message parameters <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3678],"class_list":["post-7364","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-netdbusbindingiterator"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7364"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7364\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}