[libnet-dbus-perl] 132/335: Example for listing HAL devices

Intrigeri intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:38 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 b30c2be48648f26d1d1060b00257670ec2b8ca9c
Author: Daniel P. Berrange <dan at berrange.com>
Date:   Sat Oct 15 13:24:10 2005 +0000

    Example for listing HAL devices
---
 examples/lshal.pl | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/examples/lshal.pl b/examples/lshal.pl
new file mode 100644
index 0000000..e2c7d25
--- /dev/null
+++ b/examples/lshal.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Net::DBus;
+
+my $bus = Net::DBus->system;
+
+# Get a handle to the HAL service
+my $hal = $bus->get_service("org.freedesktop.Hal");
+
+# Get the device manager
+my $manager = $hal->get_object("/org/freedesktop/Hal/Manager", "org.freedesktop.Hal.Manager");
+
+# List devices
+foreach my $dev (sort { $a cmp $b } @{$manager->GetAllDevices}) {
+    print $dev, "\n";
+}

-- 
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