[libnet-dbus-perl] 61/335: No longer require interface to be passed into emit_signal, figure it out from introspection data instead. Reverse order of server & path params in constructor
Intrigeri
intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:24 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 888ead317f8698668b383a46883cd9e70c0a0612
Author: Daniel P. Berrange <dan at berrange.com>
Date: Sun Aug 14 18:01:55 2005 +0000
No longer require interface to be passed into emit_signal, figure it out from introspection data instead. Reverse order of server & path params in constructor
---
lib/Net/DBus/Object.pm | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/Net/DBus/Object.pm b/lib/Net/DBus/Object.pm
index 07477ec..2e858e1 100644
--- a/lib/Net/DBus/Object.pm
+++ b/lib/Net/DBus/Object.pm
@@ -146,8 +146,8 @@ sub new {
my $class = shift;
my $self = {};
- $self->{object_path} = shift;
$self->{service} = shift;
+ $self->{object_path} = shift;
bless $self, $class;
@@ -172,19 +172,35 @@ sub get_object_path {
}
-sub emit_signal {
+sub emit_signal_in {
my $self = shift;
+ my $name = shift;
my $interface = shift;
- my $signal_name = shift;
my @args = @_;
- my $signal = Net::DBus::Binding::Message::Signal->new(object_path => $self->{object_path},
+
+ my $signal = Net::DBus::Binding::Message::Signal->new(object_path => $self->get_object_path,
interface => $interface,
- signal_name => $signal_name);
+ signal_name => $name);
- $self->_introspector->encode($signal, "signals", $signal_name, "params", @args);
+ $self->_introspector->encode($signal, "signals", $name, "params", @args);
$self->get_service->get_bus->get_connection->send($signal);
+}
+
+sub emit_signal {
+ my $self = shift;
+ my $name = shift;
- return ();
+ my $intro = $self->_introspector;
+ my @interfaces = $intro->has_signal($name);
+ if ($#interfaces == -1) {
+ die "no signal with name '$name' is exported in object '" .
+ $self->get_object_path . "'\n";
+ } elsif ($#interfaces > 0) {
+ die "signal '$name' is exported in more than one interface of '" .
+ $self->get_object_path . "'." .
+ "use the 'emit_signal_in' method to specify the interface\n";
+ }
+ $self->emit_signal_in($name, $interfaces[0], @_);
}
sub _dispatch {
--
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