How to launch program from Perl as a separate proc

2019-08-08 15:36发布

问题:

Possible Duplicate:
How can I fire and forget a process in Perl?

I'm looking for a way to invoke a new process from a Perl script, that will let a launched program and a Perl script, from which it's launched, proceed to work concurrently.

The program is SIPp, if it's important.

Thank you.

回答1:

If you actually want separate processes, then another option is fork and exec.

if (fork) {
  # In the parent program
  # Continue as usual
  ...
} else {
  # In the new child program
  # Replace with another program
  exec $some_other_program;
}


回答2:

SIPp has "-bg" commandline parameter.

This parameter launches SIPp in background mode.



回答3:

Use Proc::Background



回答4:

In Windows system you may use "start" command.

For example:

start notepad

OR

start /d"C\Program Files\Sipp3.1" sipp.exe -sn uac



标签: perl process sip