Undefined values in the 'command' list cause IPC::Cmd to throw
'undefined' warnings when ran under -w, as in
$ perl -MIPC::Cmd=run -we 'run command => [ $^X, "-e1", undef ]'
Use of uninitialized value $_ in length at
/home/vince/perl/builds/5.10.0/lib/5.10.0/IPC/Cmd.pm line 351.
This appears especially when you use cpan2dist, which is automatically
run under -w.
The small patch attached solves this.
Vincent.
Subject: | ipc-cmd-undefined-in-length-warnings.patch |
Index: lib/IPC/Cmd.pm
===================================================================
--- lib/IPC/Cmd.pm (revision 2654)
+++ lib/IPC/Cmd.pm (working copy)
@@ -348,7 +348,7 @@
$cmd = _quote_args_vms( $cmd ) if IS_VMS;
### strip any empty elements from $cmd if present
- $cmd = [ grep { length && defined } @$cmd ] if ref $cmd;
+ $cmd = [ grep { defined && length } @$cmd ] if ref $cmd;
my $pp_cmd = (ref $cmd ? "@$cmd" : $cmd);
print loc("Running [%1]...\n", $pp_cmd ) if $verbose;