The command passed to exec is counting all the files in the /usr directory and all its subdirectories. It takes a bit of time since there are more than 36000 entries. Under Unix, the time program measures the execution time. The first report states the time taken by the exec command. The second one gives the time taken by the Perl program. As you can see, the Perl program completed only after the exec command finished. No background process here. Under Unix, I could launch my command in the background this way:$ time perl -e 'print "start program. \n"; exec ("time ls -lR /usr | w +c");' start program. 36311 269214 1917392 real 0m8.933s user 0m1.309s sys 0m3.883s real 0m9.012s user 0m1.339s sys 0m3.929s
Here, the exec command is really launched in the background and the Perl program completes immediately (after 0.09 sec.) and the exec command prints the result and completes 4 seconds later. I do not know how you would do that under Windows, but you might have to launch an intermediate xxx.bat script that launches the background process and exits immediately.$ time perl -e 'print "start program. \n"; exec ("time ls -lR /usr | w +c &");' start program. real 0m0.090s user 0m0.045s sys 0m0.030s Laurent ~ $ 36311 269214 1917392 real 0m4.102s user 0m1.200s sys 0m2.963s
In reply to Re: Capture HTTP Error CGI Perl
by Laurent_R
in thread Windows Background forking in Perl /HTTP Error Capture
by suzun30
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |