summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xPorting/Maintainers.pl2
-rw-r--r--cpan/IPC-Cmd/lib/IPC/Cmd.pm26
-rw-r--r--pod/perldelta.pod4
3 files changed, 26 insertions, 6 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 425ba7a81e..d42d548055 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 8c7a87ef70..9cd9e972be 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<run_forked> on the current platform.
C<can_run> takes but a single argument: the name of a binary you wish
to locate. C<can_run> works much like the unix binary C<which> or the bash
command C<type>, which scans through your path, looking for the requested
-binary .
+binary.
Unlike C<which> and C<type>, 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<undef> 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<undef> 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<PATH> 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<IPC::*> module you explicitly requested.
Defaults to true. Turn this off at your own risk.
+=head2 $IPC::Cmd::INSTANCES
+
+This variable controls whether C<can_run> will return all instances of
+the binary it finds in the C<PATH> 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 17f06b2780..bc11a68d79 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -307,6 +307,10 @@ C<if> has been upgraded from version 0.05 to 0.06
=item *
+C<IPC::Cmd> has been upgraded from version 0.60 to 0.64
+
+=item *
+
C<IPC::Open3> has been upgraded from version 1.06 to 1.07.
The internal C<xclose> routine now knows how to handle file descriptors, as