archeman2 has asked for the wisdom of the Perl Monks concerning the following question:

I want to start a program that requires 4 string arguments.

The program can't use 'run', I need to use 'start' with harness because I need the script to keep that task running while the script goes off to do something else. The command isn't going to stop on it's own...by design. I'll kill_kill it afterwards.

I'm having a bit of a problem getting my head around how to get the arguments passed to the command. I can't use the $in because these aren't inputs that the command is waiting for, it needs them as arguments at the moment of invocation. I am able to call the command without arguments, but when I put the arguments in with the command string, it interprets them as separate commands. Need a little help here. I have read the documentation but that focuses on programs that take input after launch, not as arguments.

http://search.cpan.org/~toddr/IPC-Run-0.94/lib/IPC/Run.pm

my @run_connector = ('/disk2/home/rlong/workdir/auto/scripts/myConnect +orScript.pl'); my @run_connectorArgs = ('log1', '10.10.101.111', 'userName', 'myPa$$W +0rD'); use IPC::Run qw( start pump finish timeout ) ; my $in = ''; my $out = ''; my $err = ''; #####NEED HELP RIGHT HERE##### my $harness = start \@run_connector, \$in, \$out, \$err, timeout( 6 +00 ) or die "run_connector: $?\n"; print "\nSleeping 30 Seconds\n"; sleep 30; $harness->kill_kill; $?\n"; print "\nFinished run_connector\n"; print "Here is the Out:\n"; print "$out\n"; print "Here is the Error:\n"; print "$err\n";

Replies are listed 'Best First'.
Re: Passing Arguments for IPC::Run start()
by haukex (Archbishop) on Mar 16, 2017 at 20:26 UTC

    I assume these are command-line arguments? Try start [@run_connector, @run_connectorArgs], \$in, ...

      That or just put the args into @run_connector.

      Thank you that is perfect