On Aug 26, 2007, at 3:33 PM, Michael G Schwern wrote:

Max Maischein wrote:

How about using

    system(LIST)

Alas, need to capture output.


or the list form of backticks instead of interpolating strings to feed
to the shell.

What list form of backticks?


Module::Build has this helper function:

sub _backticks {
  my ($self, @cmd) = @_;
  if ($self->have_forkpipe) {
    local *FH;
    my $pid = open *FH, "-|";
    if ($pid) {
      return wantarray ? <FH> : join '', <FH>;
    } else {
      die "Can't execute @cmd: $!\n" unless defined $pid;
      exec { $cmd[0] } @cmd;
    }
  } else {
    my $cmd = $self->_quote_args(@cmd);
    return `$cmd`;
  }
}

sub have_forkpipe { 1 }

 -Ken

Reply via email to