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

Esteemed monks,

Aside fomr using a small batch file, is there a way of executing an external program and return wiothout waiting>

My code creates a ODF file, I want to launch Acrobat Reader to display the file, but I want my own app to continue without waiting for Acro Reader to close.

jdtoronto

  • Comment on Execute another program but don't wait.

Replies are listed 'Best First'.
Re: Execute another program but don't wait.
by ikegami (Patriarch) on Oct 22, 2004 at 19:25 UTC
    • fork+exec: The unix system calls (but works in Windows due to a fancy hack).
    • Win32::Process: The Windows system call.
    • system 1,: May only work in Windows
    • IPC::Open2 and IPC::Open3: Standard modules that use the best way for the current OS, while allowing you to specify the child's STDIN, STDOUT and (in Open3's case) STDERR.
Re: Execute another program but don't wait.
by perrin (Chancellor) on Oct 22, 2004 at 18:36 UTC
    Either system('command &'); or fork() and then exec().
      On windows OS's 'command &' will not work but you can use 'start command' instead.
Re: Execute another program but don't wait.
by pizza_milkshake (Monk) on Oct 22, 2004 at 18:15 UTC
    perldoc -f exec

    perl -e"\$_=qq/nwdd\x7F^n\x7Flm{{llql0}qs\x14/;s/./chr(ord$&^30)/ge;print"

      That replaces the current process. If you want your program to continue, you should fork first.