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

In perl how can I start a process in my case totem and immediately return to my perl program so I can the control totem from my perl script such as toggling to full screen etc. System waits for totem to finish. It has to be manually killed. Exec and backticks also wait. I have just discovered that putting an & at the end puts it in the background and control returns to the perl script :- system("totem /home/peter/songs_video_mpeg/$file &"); Proc::Background looks evn better So problem solved thanks

Replies are listed 'Best First'.
Re: Starting a process
by ikegami (Patriarch) on Jun 02, 2010 at 01:03 UTC

    Perl provides access to the basic system calls needed via fork, exec, pipe, open '<&', open '>&', select, wait and waitpid.

    IPC::Open3 provides a usable interface, but it's still quite low-level.

    Both IPC::Run3 and IPC::Run provide a high-level interface.

    so I can the control totem

    I don't know how totem is controlled (or even what it is), so I answered rather generically. The above tools will allow you to spawn an asynchronous child, possibly exchanging data with it via its STDIN, STDOUT and STDERR.

    Exec and backticks also wait.

    exec doesn't wait. exec doesn't even start a process for which one could wait.

Re: Starting a process
by JavaFan (Canon) on Jun 02, 2010 at 00:38 UTC
    fork() and exec(). You may want to read the perlipc manual page.
Re: Starting a process
by Anonymous Monk on Jun 02, 2010 at 01:04 UTC
Re: Starting a process
by bluescreen (Friar) on Jun 02, 2010 at 01:23 UTC
    I don't know what kind of API does totem has, meaning if it allows you to send commands through IPC or not.
    If is a classic GUI interface and you want to control it I'd recommend you to try X11::GUITest with it you can send events to the GUI such as keys or clicks. I know documentation can be overwhelming but looking at the test cases might give you a hint