From 22737eb36683c5ed955939bf047533298856eacb Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Tue, 19 Oct 2010 20:50:44 +0100 Subject: [PATCH] Update IPC-Cmd to CPAN version 0.64 [DELTA] Changes for 0.64 Tue Oct 19 19:01:05 BST 2010 ================================================= * Only enable the can_run instances behaviour when global variable $INSTANCES is set Changes for 0.62 Tue Oct 19 15:51:30 BST 2010 ================================================= * Amended can_run behaviour to run all found instances of the given binary in a list context --- Porting/Maintainers.pl | 2 +- cpan/IPC-Cmd/lib/IPC/Cmd.pm | 26 +++++++++++++++++++++----- pod/perldelta.pod | 4 ++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 425ba7a..d42d548 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -762,7 +762,7 @@ use File::Glob qw(:case); 'IPC::Cmd' => { 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/IPC-Cmd-0.60.tar.gz', + 'DISTRIBUTION' => 'BINGOS/IPC-Cmd-0.64.tar.gz', 'FILES' => q[cpan/IPC-Cmd], 'UPSTREAM' => 'cpan', }, diff --git a/cpan/IPC-Cmd/lib/IPC/Cmd.pm b/cpan/IPC-Cmd/lib/IPC/Cmd.pm index 8c7a87e..9cd9e97 100644 --- a/cpan/IPC-Cmd/lib/IPC/Cmd.pm +++ b/cpan/IPC-Cmd/lib/IPC/Cmd.pm @@ -14,9 +14,10 @@ BEGIN { use Exporter (); use vars qw[ @ISA $VERSION @EXPORT_OK $VERBOSE $DEBUG $USE_IPC_RUN $USE_IPC_OPEN3 $CAN_USE_RUN_FORKED $WARN + $INSTANCES ]; - $VERSION = '0.60'; + $VERSION = '0.64'; $VERBOSE = 0; $DEBUG = 0; $WARN = 1; @@ -185,13 +186,17 @@ providing C on the current platform. C takes but a single argument: the name of a binary you wish to locate. C works much like the unix binary C or the bash command C, which scans through your path, looking for the requested -binary . +binary. Unlike C and C, this function is platform independent and will also work on, for example, Win32. -It will return the full path to the binary you asked for if it was -found, or C if it was not. +If called in a scalar context it will return the full path to the binary +you asked for if it was found, or C if it was not. + +If called in a list context and the global variable C<$INSTANCES> is a true value +it will return a list of the full paths to instances +of the binary where found in C or an empty list if it was not found. =cut @@ -210,6 +215,8 @@ sub can_run { require File::Spec; require ExtUtils::MakeMaker; + my @possibles; + if( File::Spec->file_name_is_absolute($command) ) { return MM->maybe_command($command); @@ -220,9 +227,11 @@ sub can_run { ) { next if ! $dir || ! -d $dir; my $abs = File::Spec->catfile( IS_WIN32 ? Win32::GetShortPathName( $dir ) : $dir, $command); - return $abs if $abs = MM->maybe_command($abs); + push @possibles, $abs if $abs = MM->maybe_command($abs); } } + return @possibles if wantarray and $INSTANCES; + return shift @possibles; } =head2 $ok | ($ok, $err, $full_buf, $stdout_buff, $stderr_buff) = run( command => COMMAND, [verbose => BOOL, buffer => \$SCALAR, timeout => DIGIT] ); @@ -1702,6 +1711,13 @@ the failure to load an C module you explicitly requested. Defaults to true. Turn this off at your own risk. +=head2 $IPC::Cmd::INSTANCES + +This variable controls whether C will return all instances of +the binary it finds in the C when called in a list context. + +Defaults to false, set to true to enable the described behaviour. + =head1 Caveats =over 4 diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 17f06b2..bc11a68 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -307,6 +307,10 @@ C has been upgraded from version 0.05 to 0.06 =item * +C has been upgraded from version 0.60 to 0.64 + +=item * + C has been upgraded from version 1.06 to 1.07. The internal C routine now knows how to handle file descriptors, as -- 2.7.4