Bio-GMOD

 view release on metacpan or  search on metacpan

GMOD/Admin/Update.pm  view on Meta::CPAN

  my ($self,$path) = @_;
  return unless $path;

  my $cmd = "df -k $path";
  open (IN, "$cmd |") or $self->logit(-msg =>"get_available_space: Cannot run df command ($cmd): $!",-die=>1);

  my ($mount_point, $available_space);
  my $counter;
  while (<IN>) {
    next unless /^\//;
    my ($filesystem, $blocks, $used, $available, $use_percent, $mounted_on) = split(/\s+/);
    $mount_point = $mounted_on;
    $available_space = sprintf("%.2f", $available/1048576);
    $counter++;
  }

  unless ($mount_point && $available_space) { 
    $self->logit("get_available_space: Internal error: Cannot parse df cmd ($cmd)",-die=>1);
  }
  return ($mount_point,$available_space);
}



( run in 0.337 second using v1.01-cache-2.11-cpan-709fd43a63f )