Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
October 22, 2008, 2:32 pm
rate this thread
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?
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Re: open(@_): Do not expect to get ARRAY(0x88a4c0) arguments
Not for me
perl -wle '
open $out, q, q, qw(-s -i /) or die;
112225 4 bin 20 0 initrd.img 320641 4 root
464929 4 boot 13 0 initrd.img.old 368737 4 sbin
448897 4 cdrom 160321 8 lib 1 0 sys
480961 4 cdrom0 11 16 lost+found 2 8 tmp
679 0 dev 496993 4 media 2 4 usr
384769 8 etc 304609 4 mnt 2 4 var
128257 4 floppy 432865 4 opt 18 0 vmlinuz
2 4 home 1 0 proc 12 0 vmlinuz.old
Looking at your headers: Ubuntu, Hardy Heron? So, I believe,
perl5.10.0 (just a guess). Right?
So here we go different ways -- your code fails for you, but succedes
for me; please, provide complete minimal example and exact error
messages you've got. (That means -- copy-paste.)
Torvalds' goal for Linux is very simple: World Domination
- » FAQ 5.23 All I want to do is append a small amount of text to the end of a file. Do I sti...
- — Previous thread in » PERL Discussions