[libnet-dbus-perl] 63/335: Automatically register with mainloop, unless nomainloop is specifed. Bump to 0.32.1
Intrigeri
intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:25 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 44139e0f9bdbd16d051e919aecf48582fcc2ad91
Author: Daniel P. Berrange <dan at berrange.com>
Date: Sun Aug 14 18:04:43 2005 +0000
Automatically register with mainloop, unless nomainloop is specifed. Bump to 0.32.1
---
lib/Net/DBus.pm | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/lib/Net/DBus.pm b/lib/Net/DBus.pm
index 081254f..3355f9d 100644
--- a/lib/Net/DBus.pm
+++ b/lib/Net/DBus.pm
@@ -8,9 +8,9 @@ use Carp;
BEGIN {
-our $VERSION = '0.32.0';
-require XSLoader;
-XSLoader::load('Net::DBus', $VERSION);
+ our $VERSION = '0.32.1';
+ require XSLoader;
+ XSLoader::load('Net::DBus', $VERSION);
}
use Net::DBus::Binding::Bus;
@@ -38,17 +38,18 @@ sub find {
sub system {
my $class = shift;
- return $class->_new(Net::DBus::Binding::Bus->new(type => &Net::DBus::Binding::Bus::SYSTEM));
+ return $class->_new(Net::DBus::Binding::Bus->new(type => &Net::DBus::Binding::Bus::SYSTEM), @_);
}
sub session {
my $class = shift;
- return $class->_new(Net::DBus::Binding::Bus->new(type => &Net::DBus::Binding::Bus::SESSION));
+ return $class->_new(Net::DBus::Binding::Bus->new(type => &Net::DBus::Binding::Bus::SESSION), @_);
}
sub new {
my $class = shift;
- return $class->_new(Net::DBus::Binding::Bus->new(address => shift));
+ my $nomainloop = shift;
+ return $class->_new(Net::DBus::Binding::Bus->new(address => shift), @_);
}
sub _new {
@@ -58,8 +59,18 @@ sub _new {
$self->{connection} = shift;
$self->{signals} = {};
+ my %params = @_;
+
bless $self, $class;
+ unless ($params{nomainloop}) {
+ if (exists $INC{'Net/DBus/Reactor.pm'}) {
+ my $reactor = Net::DBus::Reactor->main;
+ $reactor->manage($self->get_connection);
+ }
+ # ... Add support for GLib and POE
+ }
+
$self->get_connection->add_filter(sub { $self->_signal_func(@_) });
return $self;
@@ -92,7 +103,7 @@ sub add_signal_receiver {
my $path = shift;
my $rule = $self->_match_rule($signal_name, $interface, $service, $path);
-
+
$self->{receivers}->{$rule} = [] unless $self->{receivers}->{$rule};
push @{$self->{receivers}->{$rule}}, $receiver;
@@ -192,7 +203,7 @@ sub _signal_func {
my $message = shift;
return 0 unless $message->isa("Net::DBus::Binding::Message::Signal");
-
+
my $interface = $message->get_interface;
my $sender = $message->get_sender;
my $path = $message->get_path;
@@ -202,10 +213,11 @@ sub _signal_func {
foreach my $rule (grep { $self->_rule_matches($_, $member, $interface, $sender, $path) }
keys %{$self->{receivers}}) {
foreach my $callback (@{$self->{receivers}->{$rule}}) {
- &$callback($interface, $member, $sender, $path, $message);
+ &$callback($message);
$handled = 1;
}
}
+
return $handled;
}
--
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