wook has asked for the wisdom of the Perl Monks concerning the following question:
sub aaa { $get_file = get("http://www.a.com/file.xml"); $button->update; $mw->update; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::Simple causing Tk error
by graff (Chancellor) on Oct 14, 2005 at 01:06 UTC | |
Anyway, maybe you need to fork a separate process to use LWP::Simple, fetch data from the web site, and store it to disk in a file, so that the Tk script can keep moving along, responding to user input events like it normally does, and maybe check teh status of the child process and the status of the XML data file. Once it's ready, notify the user somehow, or just do whatever needs to be done with the data. | [reply] |
|
Re: LWP::Simple causing Tk error
by pg (Canon) on Oct 14, 2005 at 01:41 UTC | |
Those two updates obviously will not work the way you expected. They only get accessed after the downloading is completed. During the downloading, your GUI will just sort of "hang". I have some script, sort of still "work in progress", but it helps you to attack this problem. What I did was that, I wrote the download part myself, instead of using any module so that I know the progress, and can update the progressbar every time after a portion of the downloading is done: (I am still working on it, so lots of stuffs are hardcoded, but the idea is certainly there. Take a look.)
| [reply] [d/l] |
|
Re: LWP::Simple causing Tk error
by zentara (Cardinal) on Oct 14, 2005 at 10:29 UTC | |
You can also use a callback in the LWP's request statement. Just sprinkle "$mw->update" frequently in the callback. This is a clunky solution, because of what may happen if the network connection hangs.
I'm not really a human, but I play one on earth. flash japh | [reply] [d/l] |