How to share LWP::UserAgent object between threads
-
10-06-2021 - |
Domanda
Is it possible to create a shared LWP::UserAgent object that can be used for HTTP requests in different threads?
Soluzione
The short answer is no. There may be a way to use shared mem to achieve this, but even if it were possible, I don't think you'd want to do this because there are objects stored on the user agent itself such as last error etc. If you want to synchronize cookies, you can take care of that by specifying a cookie jar that you persist and reuse ( from perldoc for LWP::UserAgent ):
$ua->cookie_jar( $cookie_jar_obj )
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow