[Module-build-checkins] [svn:Module-Build] r5886 - in Module-Build/trunk/lib/Module/Build: . Platfor
Status: Beta
Brought to you by:
kwilliams
From: <kwi...@cv...> - 2006-04-10 19:46:40
|
Author: kwilliams Date: Mon Apr 10 12:46:17 2006 New Revision: 5886 Modified: Module-Build/trunk/lib/Module/Build/Base.pm Module-Build/trunk/lib/Module/Build/Platform/MacOS.pm Module-Build/trunk/lib/Module/Build/Platform/VMS.pm Module-Build/trunk/lib/Module/Build/Platform/Windows.pm Module-Build/trunk/lib/Module/Build/Platform/os2.pm Log: Change the _backticks() method to an explicit open(-|) and exec(@cmd), which should work fine on older perls too. Modified: Module-Build/trunk/lib/Module/Build/Base.pm ============================================================================== --- Module-Build/trunk/lib/Module/Build/Base.pm (original) +++ Module-Build/trunk/lib/Module/Build/Base.pm Mon Apr 10 12:46:17 2006 @@ -339,30 +339,24 @@ return join " ", @quoted; } -# We have to create the _backticks sub dynamically, because the code -# we want to use under 5.6+ is a compile-time error under 5.005. -BEGIN { - my $code = $] >= 5.008 -? <<'---' +sub _backticks { my ($self, @cmd) = @_; - if ($self->have_multiarg_pipeopen) { + if ($self->have_forkpipe) { local *FH; - open FH, "-|", @cmd or die "Can't run @cmd: $!"; - return wantarray ? <FH> : join '', <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`; } ---- -: <<'==='; - my ($self, @cmd) = @_; - my $cmd = $self->_quote_args(@cmd); - return `$cmd`; -=== - *_backticks = eval "sub { $code }"; } -sub have_multiarg_pipeopen { $] >= 5.008 } +sub have_forkpipe { 1 } # Determine whether a given binary is the same as the perl # (configuration) that started this process. Modified: Module-Build/trunk/lib/Module/Build/Platform/MacOS.pm ============================================================================== --- Module-Build/trunk/lib/Module/Build/Platform/MacOS.pm (original) +++ Module-Build/trunk/lib/Module/Build/Platform/MacOS.pm Mon Apr 10 12:46:17 2006 @@ -6,7 +6,7 @@ use ExtUtils::Install; -sub have_multiarg_pipeopen { 0 } +sub have_forkpipe { 0 } sub new { my $class = shift; Modified: Module-Build/trunk/lib/Module/Build/Platform/VMS.pm ============================================================================== --- Module-Build/trunk/lib/Module/Build/Platform/VMS.pm (original) +++ Module-Build/trunk/lib/Module/Build/Platform/VMS.pm Mon Apr 10 12:46:17 2006 @@ -131,7 +131,7 @@ return $return_args; } -sub have_multiarg_pipeopen { 0 } +sub have_forkpipe { 0 } =back Modified: Module-Build/trunk/lib/Module/Build/Platform/Windows.pm ============================================================================== --- Module-Build/trunk/lib/Module/Build/Platform/Windows.pm (original) +++ Module-Build/trunk/lib/Module/Build/Platform/Windows.pm Mon Apr 10 12:46:17 2006 @@ -17,7 +17,7 @@ return '.'; } -sub have_multiarg_pipeopen { 0 } +sub have_forkpipe { 0 } sub ACTION_realclean { my ($self) = @_; Modified: Module-Build/trunk/lib/Module/Build/Platform/os2.pm ============================================================================== --- Module-Build/trunk/lib/Module/Build/Platform/os2.pm (original) +++ Module-Build/trunk/lib/Module/Build/Platform/os2.pm Mon Apr 10 12:46:17 2006 @@ -8,7 +8,7 @@ sub manpage_separator { '.' } -sub have_multiarg_pipeopen { 0 } +sub have_forkpipe { 0 } 1; __END__ |