Have you considered using separate processes (i.e., fork) instead? If you're not trying to share data between the tasks, then starting a new process for each conversion makes sharing problems like this moot. There's even a nice module Fork::Manager that helps you with the bookkeeping of how many jobs you want to run in parallel, when to submit new ones, etc.
Finally, since you're converting HTML to WordXML, why use Microsoft Word at all? I'm just curious, as I would think that cutting Word out of the loop may speed things up. If I had to do the HTML to WordXML conversion, I think I'd try making a minimal WordXML template, use HTML::Parser to disassemble the HTML document, and spit out the XML. Of course, not having done so, it may be a lot more complicated than I'm guessing. I've done a similar task with Excel once, though, and it was pretty easy. That task took an XML document from a database and whacked it with an XSLT transformation to spit out an HTML document that Excel had no difficulty digesting. (For me, the difficulty was learning enough XSLT to do the job. Actually, I didn't learn it, I just cargo-culted something together.)
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re: How to use Threads
by roboticus
in thread How to use Threads
by nglenn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |