Yaerox has asked for the wisdom of the Perl Monks concerning the following question:
Hey guys, I'm facing a little problem with Perl and CGI. I got a homepage with a button, on-click I'm submitting the form values and running a perl script. In this perl script I need to run a system command without waiting for the end of the command!
I did a workaround on windows local machine by finding a system command without waiting. I found out that I can run commands with a leading "start " without waiting. On windows this works fine. Reproduce: Create an perl script:
Create an Example.bat:system ( "start Example.bat 30" ); # 30 is the time in seconds to slee +p print "Finished";
timeout /t %1 :setError Exit /B 5
Now I tried to get this done on an XAMPP webserver. When I'm clicking my button I start the first perl script which is doing a system("start perl -w just_another_perl_script.pl") and printing the complete html-site. But my browser symbol which shows if a page is loading, and this "Inspect Element > Network" in Google Chrome Browsers is showing that the site is still loading.
The site shown when I started the script is just a html-link and i can click it and I'm able to get back while the scripts are still running ... but when I try to use those meta-tags to redirect isntantly to another page after pressing a button the site waits till the scripts finished like the status-symbol in browser is doing.
Ofc I did some research to find out what the problem is, and I read pretty often that I should use modules like Proc::Daemon, but If I don't have to fork/build own processes, I don't want it! Threads I looked up (just a few examples):
http://stackoverflow.com/questions/2668124/how-can-i-run-an-external-process-without-waiting-for-it-to-finish-from-a-perl-c
But this Proc::Daemon Tool can't be used on windows ...
Can someone tell me maybe how to fix my problem in case there is a chance to fix it, otherway if I have to use such modules like Proc::Daemon why Webservers (the Apache) is working like this? I mean if I have to go such a way, I want to know why I have to ...
Regards
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: CGI - run script without waiting
by scorpio17 (Canon) on Apr 15, 2014 at 14:05 UTC | |
Re: CGI - run script without waiting
by Anonymous Monk on Apr 15, 2014 at 13:54 UTC | |
Re: CGI - run script without waiting
by Anonymous Monk on Apr 15, 2014 at 17:58 UTC | |
by Yaerox (Scribe) on Apr 16, 2014 at 09:05 UTC | |
Re: CGI - run script without waiting
by Yaerox (Scribe) on Apr 15, 2014 at 14:36 UTC | |
by zentara (Archbishop) on Apr 15, 2014 at 15:24 UTC | |
by Yaerox (Scribe) on Apr 15, 2014 at 15:59 UTC | |
by Yaerox (Scribe) on Apr 16, 2014 at 08:59 UTC |
Back to
Seekers of Perl Wisdom