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

Win32::process works fine in creating a process, but does it work the same way as a thread..? I doubt...

Actually, I am looking for a way to call another perl script file from a script, so the called script will run on the background.To be more specific, even if the file(called-script) i am calling leads to a infinite loop, the calling-script must continue executing...

Is it possible to do this using Win32::Process ? Does any monk know how to go about it ?

Title edit by tye

  • Comment on Running another script in the background on Win32

Replies are listed 'Best First'.
Re: Threads
by BrowserUk (Patriarch) on Dec 18, 2002 at 11:14 UTC
      I have already read the answer, tried out the suggestion and then posed the question as i saw that Win32::process wudn't give the same kind of behaviour as given by usage of threads.

      For eg., in the purpose mentioned by me, the separate process was spawned but didnt parallely run in the background. That was why i posed the question again specifically.

      Being new to this monastery, if theres any mistake frm my part, Pardon this young monk...

        Could you explain what you mean by "but didnt parallely run in the background"? How did you come to this conclusion?

        Perhaps if you would show us the code you used to start the process, and the script that you attempted to run, we might be able to offer an explaination as to why this didn't work for you.


        Examine what is said, not who speaks.

        Sorry ! I didnt see the new replies added on to my query. Because of my lack of knowledge in searching through the monastery.

        Thanks to you, Now I've seen all the replies to my earlier question.

Re: Threads
by Nitrox (Chaplain) on Dec 18, 2002 at 13:48 UTC
    Here is a snippet of what I use to start another script that sit's in a while(1) loop polling the serial port.
    use Win32::Process; my ($perl_path) = $^X =~ /(.*)\\perlse\.dll$/i; $perl_path =~ s/\\/\//g; Win32::Process::Create($Obj,$perl_path . "/perl.exe","perl poller.pl", +0,DETACHED_PROCESS,"/scripts") or die ErrorReport();
    -Nitrox
Re: Running another script in the background on Win32
by John M. Dlugosz (Monsignor) on Dec 18, 2002 at 17:24 UTC
    Starting a new process with the Win32 API function CreateProcess should do exactly that.

    Check out Perl 5.8, newly released for Windows by ActiveState. It has threads.