Welcome to WebmasterWorld Guest from 126.96.36.199
As the info it was looking up was increasing, it was taking longer and longer, and I was getting annoyed with it.
So I converted it to use::threads;
Basically, the threads are simple, it spawns x threads simultaneously, to do the searching, and joins them immediately, hence waiting for them all to finish and reporting their results.
This works fine, the only problem is, the server sometimes doesn't kill the process anymore, and I eventually get a CGI timeout error.
Even if I put a die at the end of the script, the text "Died at ....." appears in the HTML, but the progress bar still doesn't stop, and the process doesn't disappear off my server.
If I reun the script from a command line, it runs and terminates instantly as it should.
Anyone else had a problem with multi-threaded CGI?
Seems like you could learn something! Very handy and easy for parallel processing. Why run 12 API's at once, when you can run all 12 simultaneously, then the total time taken is only the time of the single longest one.
Anyway, as I said, you run a new thread, and if you don't detach it, you call $thread -> join; and it waits for the thread to terminate.