home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / libnet-dbus-perl / examples / lshal.pl < prev   
Encoding:
Perl Script  |  2006-06-03  |  643 b   |  23 lines

  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use Net::DBus;
  5.  
  6. my $bus = Net::DBus->system;
  7.  
  8. # Get a handle to the HAL service
  9. my $hal = $bus->get_service("org.freedesktop.Hal");
  10.  
  11. # Get the device manager
  12. my $manager = $hal->get_object("/org/freedesktop/Hal/Manager", "org.freedesktop.Hal.Manager");
  13.  
  14. print "Warning. There may be a slight pause while this next\n";
  15. print "method times out, if your version of HAL still just\n";
  16. print "silently ignores unsupported method calls, rather than\n";
  17. print "returning an error. The timeout is ~60 seconds\n";
  18.  
  19. # List devices
  20. foreach my $dev (sort { $a cmp $b } @{$manager->GetAllDevices}) {
  21.     print $dev, "\n";
  22. }
  23.