Domanda

Is it possible to create a shared LWP::UserAgent object that can be used for HTTP requests in different threads?

È stato utile?

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
scroll top