in reply to Re^2: WWW::Curl and making it thread safe
in thread WWW::Curl and making it thread safe
I'd suggest the reverse of the anonymous monk: put WWW::Curl into a thread by itself, don't load it in the main program, and serialise everything through there. You might be able to get that to multi-thread if each thread that uses W::C were to load it individually, but I doubt it.
I suspect there are better (read: simpler / less prone to headdesk interactions) ways to run multiple HTTP requests simultaneously than trying to get WWW::Curl to play nice with perl threads. An event-based callback (POE, AnyEvent/Coro, etc.) where you can queue up multiple requests at once springs to mind, or pushing the actual W::C calls into forked worker children (that you then get back using either event or thread-based parents). Personally, I would usually use AnyEvent and either LWP::UserAgent (with the AnyEvent "hack" to LWP to get it to play nice with AE) or AnyEvent::HTTP. YMMV.