K
kj
I've written a script that is supposed to serve as a wrapper around
an existing command-line utility (which I'll call "foobar" below).
This utility has a very rich and complex set of command-line options,
so, in order to have the wrapper script follow the original utility's
calling conventions as closely as possible, while bypassing the
shell, I had the line
open my $out, '|-', 'foobar', @ARGV or die $!;
....but open complains with
Internal error: open(@_): Do not expect to get ARRAY(0x88a4c0) arguments
I can avoid the error if instead I use
open my $out, "|foobar @ARGV" or die $!;
....but this can lead to errors (e.g. if one of the original arguments
is a quoted string with embedded whitespace).
Is this a bug in the design of open, or a feature?
More importantly, is there a way around this problem?
TIA!
Kynn
an existing command-line utility (which I'll call "foobar" below).
This utility has a very rich and complex set of command-line options,
so, in order to have the wrapper script follow the original utility's
calling conventions as closely as possible, while bypassing the
shell, I had the line
open my $out, '|-', 'foobar', @ARGV or die $!;
....but open complains with
Internal error: open(@_): Do not expect to get ARRAY(0x88a4c0) arguments
I can avoid the error if instead I use
open my $out, "|foobar @ARGV" or die $!;
....but this can lead to errors (e.g. if one of the original arguments
is a quoted string with embedded whitespace).
Is this a bug in the design of open, or a feature?
More importantly, is there a way around this problem?
TIA!
Kynn