Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: LWP::UserAgent timeout

by markong (Pilgrim)
on Dec 17, 2018 at 14:09 UTC ( [id://1227353]=note: print w/replies, xml ) Need Help??


in reply to Re: LWP::UserAgent timeout
in thread LWP::UserAgent timeout

I'd just add that, in either case, given that you are dealing with a GUI, it's usually a best practice to use a separate thread for the UI events processing and another for the processing:

  1. LWP::UserAgent::timeout() it's a lower bound: "The requests is aborted if no activity on the connection to the server is observed for "timeout" seconds.This means that the time it takes for the complete transaction and the request() method to actually return might be longer."
  2. Depending on what you do when you # deal with $response there are good chances you'll end freezing again your UI

Replies are listed 'Best First'.
Re^3: LWP::UserAgent timeout
by IB2017 (Pilgrim) on Dec 17, 2018 at 17:42 UTC

    Multi-threads, i.e. separating UI and other stuff, make sure sense. However, it frightens me turning my application in a multi-threads one. My GUI is Tk and Tk is said to be "not thread safe". Zero experience on my side.

      Look at Tk::IO

      I will second the multi-thread model if you have heavy calculations or a fair amount of other networking. I was under the impression that your only network interaction would be the one you showed. However, I have zero knowledge of Tk myself.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227353]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-19 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found