Re: [patch] First batch of whitespace patches (ExtUtils::MakeMaker)

2007-08-26 Thread Michael G Schwern
Max Maischein wrote:
 ...
 Thanks for all that work.  But I look at it and... guh, its so much
 WORK!  I
 keep thinking there's got to be a lazier way to handle the problem.
 
 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?


 That would be safer and saner. Except I seem to remember that
 
 open -|, ...
 
 has problems on Win32, but the problems I encountered might have been
 buffering problems.
 
 I see no way to do clever modification of $^X, because the tests partly
 use system(LIST), which works if $^X contains whitespace but fails if
 $^X is quoted shell-safe, and use $^X in string interpolation, which
 fails if $^X contains whitespace unless $^X is quoted shell-safe.

My lament was sort of a general lament not specific to MakeMaker.  A the
programmer shouldn't have to be this careful thing.

A version of system(LIST) which captured would go a long way towards helping.


-- 
Whip me, beat me, make my code compatible with VMS!


Re: [patch] First batch of whitespace patches (ExtUtils::MakeMaker)

2007-08-26 Thread Ken Williams


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