Hi all,
I'm having a problem issuing an exec @list and then doing a
subsequent GetOptions (... call.
What I want to do is call exec with a list, so that shell
metacharacters aren't interpreted.
The called program should then use GetOptions to parse the command
switches passed.
In a few snippets, this is what I'm doing.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First program.
@CmdList = ("./hello.pl"," -p \"this is my parm\" -m \"this is my
message\" -o \"this is my option\"","data1 data2 data3 data4 data5",);
exec @list;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Second program hello.pl
use Getopt::Long;
GetOptions ( "p=s" => \$opt_p, "m=s" => \$opt_m, "o=s" => \$opt_o,
);
print "prog name <$0>, opt_p <$opt_p>, opt_m <$opt_m>, opt_o
<$opt_o>, cmdline <" . join(",",@ARGV) .">\n";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The result
prog name <./hello.pl>, opt_p <>, opt_m <>, opt_o <>, cmdline < -p
"this is my parm" -m "this is my message" -o "this is my option",data1 data2
data3 data4 data5>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Naturally what I want to see from the hello.pl script is the following
prog name <./hello.pl>, opt_p <this is my parm>, opt_m <this is my
message>, opt_o <this is my option>, cmdline < data1, data2, data3, data4,
data5>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any help with this would be greatly appreciated.
Alex Ignacz
Atco Itek
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs