Can perl start another perl script and then exit?

Can perl start another perl script and then exit?

am 18.09.2007 00:44:13 von Bill H

I need to have a perl script start another script and then exit,
returning completed header information to a web page. The other
program will continue running on the server processing some pdf files,
and when done it will set a flag.

The web page, once it initiates the 1st program (which starts the
background program) and receive the status from the 1st program (using
flash) will then start a 3rd program, which checks for the "done
flag", if it isn't set it will tell the web page (flash) to try again.
This will continue to the 2nd program is complete.

So, can I start a 2nd script in perl and have the 1st program exit
without effecting the 2nd program? System() would just wait, Exec()
would start the 2nd and leave the 1st behind.

If this is something obvious that I am missing, please point me in the
right direction.

Thanks
Bill H

Re: Can perl start another perl script and then exit?

am 18.09.2007 02:03:31 von Mahesh M

On Sep 17, 3:44 pm, Bill H wrote:
> I need to have a perl script start another script and then exit,
> returning completed header information to a web page. The other
> program will continue running on the server processing some pdf files,
> and when done it will set a flag.
>
> The web page, once it initiates the 1st program (which starts the
> background program) and receive the status from the 1st program (using
> flash) will then start a 3rd program, which checks for the "done
> flag", if it isn't set it will tell the web page (flash) to try again.
> This will continue to the 2nd program is complete.
>
> So, can I start a 2nd script in perl and have the 1st program exit
> without effecting the 2nd program? System() would just wait, Exec()
> would start the 2nd and leave the 1st behind.
>
> If this is something obvious that I am missing, please point me in the
> right direction.

Sounds like something threads could do. Have you tried 'perldoc
threads'?

HTH,
Mahesh.

Re: Can perl start another perl script and then exit?

am 18.09.2007 02:06:49 von Ben Morrow

Quoth Bill H :
> I need to have a perl script start another script and then exit,
> returning completed header information to a web page. The other
> program will continue running on the server processing some pdf files,
> and when done it will set a flag.
>
> The web page, once it initiates the 1st program (which starts the
> background program) and receive the status from the 1st program (using
> flash) will then start a 3rd program, which checks for the "done
> flag", if it isn't set it will tell the web page (flash) to try again.
> This will continue to the 2nd program is complete.

It is probably possible to do this without polling, which would be
easier on the network. I don't know if Flash times out HTTP requests,
but if it can be told not to one obvious way is for the third script to
simply hold off sending a reply until it is done. Of course, if you want
to do other Flash stuff simultaneously, this may not be possible unless
you can get Flash to make the request asynchronously.

> So, can I start a 2nd script in perl and have the 1st program exit
> without effecting the 2nd program? System() would just wait, Exec()
> would start the 2nd and leave the 1st behind.
>
> If this is something obvious that I am missing, please point me in the
> right direction.

perldoc -q background

Ben

Re: Can perl start another perl script and then exit?

am 18.09.2007 02:07:06 von Bill H

On Sep 17, 8:03 pm, Mahesh Asolkar wrote:
> On Sep 17, 3:44 pm, Bill H wrote:
>
>
>
>
>
> > I need to have a perl script start another script and then exit,
> > returning completed header information to a web page. The other
> > program will continue running on the server processing some pdf files,
> > and when done it will set a flag.
>
> > The web page, once it initiates the 1st program (which starts the
> > background program) and receive the status from the 1st program (using
> > flash) will then start a 3rd program, which checks for the "done
> > flag", if it isn't set it will tell the web page (flash) to try again.
> > This will continue to the 2nd program is complete.
>
> > So, can I start a 2nd script in perl and have the 1st program exit
> > without effecting the 2nd program? System() would just wait, Exec()
> > would start the 2nd and leave the 1st behind.
>
> > If this is something obvious that I am missing, please point me in the
> > right direction.
>
> Sounds like something threads could do. Have you tried 'perldoc
> threads'?
>
> HTH,
> Mahesh.- Hide quoted text -
>
> - Show quoted text -

Thanks for the tip Mahesh. Will look into threads.

BIll H

Re: Can perl start another perl script and then exit?

am 18.09.2007 18:55:30 von Jim Gibson

In article <1190069053.257334.95610@r29g2000hsg.googlegroups.com>, Bill
H wrote:

> I need to have a perl script start another script and then exit,
> returning completed header information to a web page. The other
> program will continue running on the server processing some pdf files,
> and when done it will set a flag.
>
> The web page, once it initiates the 1st program (which starts the
> background program) and receive the status from the 1st program (using
> flash) will then start a 3rd program, which checks for the "done
> flag", if it isn't set it will tell the web page (flash) to try again.
> This will continue to the 2nd program is complete.
>
> So, can I start a 2nd script in perl and have the 1st program exit
> without effecting the 2nd program? System() would just wait, Exec()
> would start the 2nd and leave the 1st behind.

I do pretty much what you describe in one application. The idea is to
fork the process, return a web page immediately to the client, and use
"client-pull" to monitor the progress of the long child process.

I used the technique described here:

http://www.stonehenge.com/merlyn/LinuxMag/col39.html

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com