Daniel P. Berrangé > Net-DBus-0.32.3 > Net::DBus::Binding::Iterator

Download:
Net-DBus-0.32.3.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  8
Open  0
View/Report Bugs
Source   Latest Release: Net-DBus-1.0.0

NAME ^

Net::DBus::Binding::Iterator - Reading and writing message parameters

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 mesage

  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. The array and dictionary types are not yet supported, and there are bugs in the Quad support (ie it always returns -1!).

METHODS ^

$res = $iter->has_next()

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.

$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_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

my $val = $iter->get_uint64()

$iter->append_uint64($val);

Read or write an unsigned 64 bit value from/to the message iterator

my $val = $iter->get_double()

$iter->append_double($val);

Read or write a double precision floating point value from/to the message iterator

SEE ALSO ^

Net::DBus::Binding::Message

AUTHOR ^

Daniel Berrange <dan@berrange.com>

COPYRIGHT ^

Copyright 2004 by Daniel Berrange

syntax highlighting: