Semantics of o.fd.DBus.Properties

Daniel P. Berrange dan at berrange.com
Fri Feb 8 07:50:51 PST 2008


On Fri, Feb 08, 2008 at 03:10:50PM +0000, Simon McVittie wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Fri, 08 Feb 2008 at 14:53:16 +0000, Daniel P. Berrange wrote:
> > A few notes on how I deal with this in Perl bindings...
> > > * Are "complete" bindings required to support properties of the same name
> > >   in different interfaces?
> > 
> > The Perl bindings support this, though its easier for people if all the
> > property names are unique.  Normally you can just acess the property
> > directly from the object
> > 
> >     $obj->SomeProp($newval)
> > 
> > or
> > 
> >     $val = $obj->SomeProp()
> 
> I'm more interested in service-side - as you say, in a client you can always
> make the method calls directly (and in fact this is all you can do in at
> least GLib and Python, and possibly Qt - GLib special-cases properties
> on the service-side but not on the client-side). Do you support
> implementing a service in Perl?

Yes, on the service side we require that all method names and properties
in an object are unique. You can have multiple interfaces on an object
but we don't provide any way to define methods with the same name in
two interfaces on the same object.

This is because you simply define a method in perl and annotate it
to export it in the service - the perl method and the exported name
have to be the same and the impls are all in the same Perl package
namespace.

eg  this dumb exmaple showing an object in org.example.Employee
interface, with a single property and a single method.

package Employee;

use base qw(Net::DBus::Object);
use Net::DBus::Exporter qw(org.example.Employee);

dbus_property("salary", "int32", "readwrite");
sub salary {
    my $self = shift;
    $self->{salary} = shift if @_;
    return $self->{salary};
}

dbus_method("layoff");
sub layoff {
    my $self = shift;
     ....blah...
}



I could probably come up with a way to allowing multiple interfaces on
an object each with same method names, but no user has asked for this
yet so I've not bothered with it yet.

Dan.
-- 
|=-            GPG key: http://www.berrange.com/~dan/gpgkey.txt       -=|
|=-       Perl modules: http://search.cpan.org/~danberr/              -=|
|=-           Projects: http://freshmeat.net/~danielpb/               -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|


More information about the dbus mailing list