[tpm] DBus woes

Scott Elcomb psema4 at gmail.com
Thu Jan 27 12:19:13 PST 2011


Hi all,

I'd like to start working with Desktop Couch[1], the DBus + CouchDB
service behind Ubuntu One[2].

As I haven't really worked with DBus before I'm a bit stuck; before I
go off to bug the desktopcouch list I'd like to make sure I understand
the Perl side of the issue.

Here's a really simple little script that is supposed to retrieve the
port # on which the current user's desktopcouch instance is listening.

[-- sample starts --]
#!/usr/bin/env perl

use strict;
use warnings;
use Net::DBus;

# shell example:
#   dbus-send --session \
#   --dest=org.desktopcouch.CouchDB \
#   --print-reply \
#   --type=method_call / org.desktopcouch.CouchDB.getPort

my $port_number = -1;

my $svc_object = Net::DBus->session
    ->get_service('org.desktopcouch.CouchDB')
    ->get_object('/org/desktopcouch/CouchDB')
;

# Doesn't work because $svc_object has no interface
# $port_number = $svc_object->getPort();

print "Desktop CouchDB is running on port: $port_number\n";
[-- sample ends --]

The desktopcouch specs page[1] refers developers to couchdb-glib[3]
and (for Perl devs) to Glib::Object::Introspection[4].  On the surface
it looks to me like [4] should fix the missing interface issue but I'm
unsure on how to proceed... I much prefer working with pure perl
modules and have never needed to wrap a C library before.

Any help or pointers would be most appreciated.

Thanks,
- Scott.


[1] <http://freedesktop.org/wiki/Specifications/desktopcouch>
[2] <https://one.ubuntu.com/>
[3] <https://launchpad.net/couchdb-glib>
[4] <http://live.gnome.org/GTK2-Perl/Introspection>
-- 
  Scott Elcomb
  http://www.psema4.com/   @psema4

  Member of the Pirate Party of Canada
  http://www.pirateparty.ca/


More information about the toronto-pm mailing list