SPUG: running multiple scripts concurrently

Moncef Maiza mmaiza at digimine.com
Tue Jun 12 21:28:48 CDT 2001


If you do not mind using win32::Process then
you can make use of things like win32::Process::Create
or win32::Process::CreateProcessAsUser. 
The advantage here is that you can control your process, 
kill it, suspend it, waiting for it to end as well as set 
priorities.

Here's a little example:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
use Win32::Process;

$Pid = Win32::Process::Create($Process, 
			      "c:\\apps\\perl\\bin\\perl.exe",
			      "perl test.pl",
			      1, 
			      CREATE_NEW_PROCES, 
			      ".");
if ($Pid)
  {
    print "Process was created with ID of $Pid \n";
  }else{
    print "Unable to run $Command. \n";
    print "Error: ".Win32::FormatMessage(Win32::GetLastError() );
  }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Check the ActiveState help. The 4th parameter "1" determines whether
your subprocess inherits handles or not (careful, here).

Moncef Maiza
digiMine


-----Original Message-----
From: Richard Anderson [mailto:Richard.Anderson at raycosoft.com]
Sent: Tuesday, June 12, 2001 5:31 PM
To: Alex Algard; Martin Korb; spug-list at pm.org
Subject: Re: SPUG: running multiple scripts concurrently


As of last year, fork did not work on Windows.  ActiveState was working on
implementing fork in ActivePerl, don't know what the status of it on Windows
95 / 98/ NT / 2000 / ad naseum is ...

Cheers,
Richard
----- Original Message -----
From: "Alex Algard" <algard at cardomain.com>
To: "Martin Korb" <mkorb at versuslaw.com>; <spug-list at pm.org>
Sent: Tuesday, June 12, 2001 3:58 PM
Subject: RE: SPUG: running multiple scripts concurrently


> Check out the fork() function. On the other hand, I don't know much about
> Win32, and there might be alternatives to it that work better on Win32.
> ________________________
> Alex Algard
> CarDomain Networks, Inc.
> 425-820-2244 x111 | fax: 425-820-5951
> algard at cardomain.com
>
>
>   -----Original Message-----
>   From: owner-spug-list at pm.org [mailto:owner-spug-list at pm.org]On Behalf Of
> Martin Korb
>   Sent: Tuesday, June 12, 2001 2:54 PM
>   To: spug-list at pm.org
>   Subject: SPUG: running multiple scripts concurrently
>
>
>   Here is the scenario.
>   I have a perl scripts (first.pl) which does a system call to initiate a
> 2nd script (second.pl) or a 2nd executable (second.exe). I would like to
> initiate a 3rd script (third.pl) from  first.pl  while  second.pl  is
still
> running. The second and third scripts are independent of each other and do
> different things (meaning neither task has to be completed or completed
> successfully for the other script to do its task). All this needs to
happen
> on a Win32 platform.
>
>   Thanks for any help and/or direction.
>
>   hmk
>



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/spug-list/attachments/20010612/6a4a1803/attachment.htm


More information about the spug-list mailing list