http://qs321.pair.com?node_id=11115303


in reply to Re^2: Break out from download
in thread Break out from download

LWP invokes the callback inside an eval; using die will be caught and translated into an "X-Died" header in the response object.

You will need to arrange for the "Cancel" button to set a flag that the callback then checks. Having the Tk callback handler directly die will abort the run through the event loop and may or may not cause problems. Tk is a very complex XS module, so it would be best to avoid throwing an exception "around the event loop" directly.