in reply to perl tk and Device::Modem
If you look at the dial method in Modem.pm, it incorporates a timeout, and it probably is "blocking the gui" while it dials and waits for the timeout to connect. So during that time Tk is blocked. A possible solution, is not to use the dial method, and manually send out each digit at a time, and in-between let Tk do a 1-loop, to see if you hit the cancel button. Something like:
use Tk::Event qw(DONT_WAIT); sub push_button { $txt -> insert ('end',"Dialing $number\n"); #$modem->dial($number); my (@n) = $number =~ /\d/g; foreach my $d (@n){ $modem->atsend( 'ATDT'. $d . Device::Modem::CR ); DoOneEvent(DONT_WAIT); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl tk and Device::Modem
by strange1 (Initiate) on Apr 25, 2006 at 20:22 UTC | |
by zentara (Cardinal) on Apr 25, 2006 at 22:43 UTC |