#!/usr/bin/perl
# This is a slight variant on an example provided by Net::DBus.

use strict;
use warnings;

# Load the Net::DBus D-Bus binding.
use Net::DBus;

# Connect to the system bus.
my $bus = Net::DBus->system;

# Get a handle to the HAL service.
my $hal = $bus->get_service("org.freedesktop.Hal");

# Get a handle to the device manager.
my $manager = $hal->get_object("/org/freedesktop/Hal/Manager", "org.freedesktop.Hal.Manager");

# Get a reference to the array of hardware provided by HAL's 'GetAllDevices' method.
my $hal_list=$manager->GetAllDevices;

# List the devices now.
print "All the hardware that HAL knows about is below:\n";
foreach my $dev (@{$hal_list})
{
	print "Device: [$dev]\n";
}
exit(0);
