[libnet-dbus-perl] 89/335: Added examples without introspection data

Intrigeri intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.

commit 59cb29800a14f59684b622b8d57fe1eea7d442f2
Author: Daniel P. Berrange <dan at berrange.com>
Date:   Mon Aug 29 12:40:16 2005 +0000

    Added examples without introspection data
---
 examples/example-client-no-introspect.pl  | 23 ++++++++++++++
 examples/example-service-no-introspect.pl | 50 +++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/examples/example-client-no-introspect.pl b/examples/example-client-no-introspect.pl
new file mode 100644
index 0000000..37275fc
--- /dev/null
+++ b/examples/example-client-no-introspect.pl
@@ -0,0 +1,23 @@
+#/usr/bin/perl
+
+use Net::DBus;
+use Carp qw(cluck carp);
+#$SIG{__WARN__} = sub { cluck $_[0] };
+#$SIG{__DIE__} = sub { carp $_[0] };
+
+my $bus = Net::DBus->find();
+
+my $service = $bus->get_service("org.designfu.SampleService");
+my $object = $service->get_object("/SomeObject", "org.designfu.SampleInterface");
+
+my $list = $object->HelloWorld("Hello from example-client.pl!");
+
+print "[", join(", ", map { "'$_'" } @{$list}), "]\n";
+
+my $tuple = $object->GetTuple();
+
+print "(", join(", ", map { "'$_'" } @{$tuple}), ")\n";
+
+my $dict = $object->GetDict();
+
+print "{", join(", ", map { "'$_': '" . $dict->{$_} . "'"} keys %{$dict}), "}\n";
diff --git a/examples/example-service-no-introspect.pl b/examples/example-service-no-introspect.pl
new file mode 100644
index 0000000..e57ffe8
--- /dev/null
+++ b/examples/example-service-no-introspect.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+use Carp qw(confess cluck);
+use Net::DBus;
+use Net::DBus::Service;
+use Net::DBus::Reactor;
+
+#...  continued at botom
+
+
+package SomeObject;
+
+use base qw(Net::DBus::Object);
+
+sub new {
+    my $class = shift;
+    my $service = shift;
+    my $self = $class->SUPER::new($service, "/SomeObject");
+    bless $self, $class;
+    
+    return $self;
+}
+
+sub HelloWorld {
+    my $self = shift;
+    my $message = shift;
+    print "Do hello world\n";
+    print $message, "\n";
+    return ["Hello", " from example-service.pl"];
+}
+
+sub GetDict {
+    my $self = shift;
+    print "Do get dict\n";
+    return {"first" => "Hello Dict", "second" => " from example-service.py"};
+}
+
+sub GetTuple {
+    my $self = shift;
+    print "Do get tuple\n";
+    return ["Hello Tuple", " from example-service.py"];
+}
+
+package main;
+
+my $bus = Net::DBus->find();
+my $service = $bus->export_service("org.designfu.SampleService");
+my $object = SomeObject->new($service);
+
+Net::DBus::Reactor->main->run();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git



More information about the Pkg-perl-cvs-commits mailing list