As a workaround you could use

system("start /b myscript.pl");


Kind regards,

Mark Anderson
SMS Deployment
The Royal Bank of Scotland
113 Dundas Street, Edinburgh, EH3 5DE
http://www.manufacturing.rbs.co.uk/GTrswi/


> -----Original Message-----
> From: Finn Harald Rĝed [SMTP:[EMAIL PROTECTED]
> Sent: Tuesday, July 06, 2004 11:06 PM
> To:   $Bill Luebkert
> Cc:   [EMAIL PROTECTED]
> Subject:      Re: Starting a Perl-script with Win32::Process
> 
> *** WARNING : This message originates from the Internet ***
> 
> Thanks a lot for your reply! 
> The "DETACHED_PROCESS" doesnt seem to work...as far as I can see it
> doesn't start any process on the webserver. When I use "CREATE_SUSPENDED",
> however, the process starts (perl.exe), but the script doesn't seem to run
> (all the script is supposed to do for now is to write/create a test-file,
> but nothing happens - not even any error messages anywhere). The script
> has only two lines of code: 
> open (FIL, "> test.txt") or die "Couldn't create file"; 
> close(FIL); 
> 
> As for error messages from Create, the ErrorReport() doesn't give me any
> error message, but if I put the line "print Win32::FormatMessage(
> Win32::GetLastError() );" at the end of the code, it prints out "The
> system cannot find the path specified.". This doesn't make much sense,
> though, since I am very sure of that both the path to perl.exe and to the
> perl-script that I want to start are correct. 
> 
> I'm kind of stuck... hope you are able to help me out... 
> 
> / Finn H
> 
> 
> ----- Original Message ----- 
> From: "$Bill Luebkert" <[EMAIL PROTECTED]>
> To: "Finn Harald Rĝed" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 05, 2004 9:37 PM
> Subject: Re: Starting a Perl-script with Win32::Process
> 
> 
> Finn Harald Rĝed wrote:
> 
> > Hello, 
> > 
> > I just can't get Win32::Process to work the way I want. I can start a
> process (perl.exe) on the server, but it doesn't really do anything. I'm
> writing a perl-script that can be summed up like this: 
> > 
> > 1. Start script1.pl via a webpage
> > 2. The script starts script2.pl by using Win32::Process::Create(); 
> >     PS! script2.pl is supposed to run independently of script1.pl, since
> it may use up to one hour + to complete it's task. 
> > 3. The script1.pl finishes (so that the user can close the browser),
> while script2.pl continues to run until it is done. 
> > 
> > I'm using Windows 2000 Server SP4 and ActiveState Perl 5.21 (I know it's
> old, but could that be a problem...?). Here's my Win32::Process code: 
> > # --------------------
> > use Win32::Process;
> > 
> > sub ErrorReport{
> >     print Win32::FormatMessage( Win32::GetLastError() );
> >         }
> > 
> >     Win32::Process::Create($ProcessObj,
> >                 "c:\\perl\\bin\\perl.exe",
> >                 "perl d:\\FULL_PATH_HERE\\test2.pl",
> >                 0,
> >                 CREATE_SUSPENDED,
> 
> You want DETACHED_PROCESS option I assume.
> 
> Note: CREATE_SUSPENDED 
> The primary thread of the new process is created in a
> suspended state, and does not run until the ResumeThread
> function is called.
> 
> >                 ".")|| die ErrorReport();
> >     $ProcessObj->Suspend();
> >     $ProcessObj->Resume();
> >     $ProcessObj->Wait(INFINITE);
> 
> Once detached you won't need the above 3 unless you need to wait
> on it for some reason.
> 
> > # ------------------------
> > 
> > PS! The NTFS-user has permission to read and execute the perl.exe file. > > Do I 
> > need the full path to the script? The script is NOT located at the
> same place as perl.exe. The only way I can start a process at all is by
> using "CREATE_SUSPENDED". Nothing happens whatsoever with any of the other
> alternatives... 
> > Actually, whether the three last lines in the script are there or not
> doesn't make any difference at all on the result. By the way, what exactly
> is the "Wait(INFINITE)" supposed to do...? It seems like all it does is to
> make the script "hang" for a while... 
> > 
> > Any ideas? :-) 
> 
> Are you getting any error on the create ?
> 
> -- 
>   ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
>  (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
>   / ) /--<  o // //      Castle of Medieval Myth & Magic
> http://www.todbe.com/
> -/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
> 
> 
> 
> 
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 
36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial Services 
Authority and represents The Royal Bank of Scotland Marketing Group. The Bank sells 
life policies, collective investment schemes and pension products and advises only on 
the Marketing Group's range of these products and on a With-Profit Bond produced by 
Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the message 
is received by anyone other than the addressee, please return the message to the 
sender by replying to it and then delete the message from your computer. Internet 
e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept 
responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is 
the responsibility of the recipient to ensure that the onward transmission, opening or 
use of this message and any attachments will not adversely affect its systems or data. 
No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the 
recipient should carry out such virus and other checks as it considers appropriate.


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to