The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Hal::Cdroms - access cdroms through HAL and D-Bus

SYNOPSIS

  use Hal::Cdroms;

  my $hal_cdroms = Hal::Cdroms->new;

  foreach my $hal_path ($hal_cdroms->list) {
     my $m = $hal_cdroms->get_mount_point($hal_path);
     print "$hal_path ", $m ? "is mounted in $m" : "is not mounted", "\n";
  }

  my $hal_path = $hal_cdroms->wait_for_insert;
  my $m = $hal_cdroms->mount($hal_path);
  print "$hal_path is now mounted in $m\n";

DESCRIPTION

Access cdroms through HAL and D-Bus.

Hal::Cdroms->new

Creates the object

$hal_cdroms->list

Returns the list of hal_path of the cdroms (mounted or not).

$hal_cdroms->get_mount_point($hal_path)

Return the mount point associated to the hal_path, or undef it is not mounted.

$hal_cdroms->ensure_mounted($hal_path)

Mount the hal_path if not already mounted. Return the mount point associated to the hal_path, or undef it cannot be mounted successfully (see $hal_cdroms->{error}).

$hal_cdroms->mount_through_hal($hal_path)

Mount the hal_path through HAL Return the mount point associated to the hal_path, or undef it cannot be mounted successfully (see $hal_cdroms->{error}). If the cdrom is listed in fstab, HAL will refuse to mount it.

$hal_cdroms->mount($hal_path)

Mount the hal_path through HAL or fallback to plain mount(8). Return the mount point associated to the hal_path, or undef it cannot be mounted successfully (see $hal_cdroms->{error})

$hal_cdroms->unmount($hal_path)

Unmount the hal_path. Return true on success (see $hal_cdroms->{error} on failure) If the cdrom is listed in not mounted by HAL, HAL will refuse to unmount it.

$hal_cdroms->unmount($hal_path)

Unmount the hal_path through HAL or fallback on umount(8). Return true on success (see $hal_cdroms->{error} on failure)

$hal_cdroms->eject($hal_path)

Ejects the hal_path. Return true on success (see $hal_cdroms->{error} on failure)

$hal_cdroms->wait_for_insert([$timeout])

Waits until a cdrom is inserted. Returns the inserted hal_path on success. Otherwise returns undef.

You can give an optional timeout in milliseconds.

$hal_cdroms->wait_for_mounted([$timeout])

Waits until a cdrom is inserted and mounted by a volume manager (eg: gnome-volume-manager). Returns the mounted hal_path on success. Otherwise returns undef.

You can give an optional timeout in milliseconds.

AUTHOR

Pascal Rigaux <pixel@mandriva.com>