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

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: system calls problem
by Aragorn (Curate) on May 27, 2004 at 08:11 UTC
    Is "blabla.exe" a program which runs for a long time? system returns when the program called from it exits. If you want to fire off a program without waiting for it, you'll have to look into calling fork and exec yourself (system does a fork and exec, but waits for the child process to finish).

    Update: From the "blabla.exe" I infer that you're using a Windows system. A look at Win32::Process could also help if portability is not an issue.

    Arjen

Re: system calls problem
by muntfish (Chaplain) on May 27, 2004 at 08:14 UTC

    In theory, no reason why that shouldn't work. You don't say what actually happens in your case.

    • Does it hang after running blabla.exe?
    • Does it not even run that properly?
    • Does it exit immediately after running blabla.exe?

    Maybe blabla.exe is not actually exiting. Perhaps it is waiting for some input.

    If you could post a bit more of your code, and maybe tell us what the external program is trying to do, that would help.

    s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&;
Re: system calls problem
by snadra (Scribe) on May 27, 2004 at 08:21 UTC
    Try to execute the whole path.
    If that does not help, maybe the programm you try to call is causing the problem. system() is doing a fork, and the process is waitng for the child process to complete.
    If you don't need to fork (the return) try exec(), wich does not do a return:
    exec('C\pogramms\programm.exe', $file_to_open);

    snadra
      Be aware of the fact that the reason that exec doesn't return is that the called program is run instead of the caller. The program image of your script (i.e. the Perl interpreter running your script in memory) is replaced with the execed program.

      Arjen