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:
system ( "start Example.bat 30" ); # 30 is the time in seconds to slee
+p
print "Finished";
Create an Example.bat:
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.