| Eric Promislow 2004-10-02, 3:55 am |
| For your consideration, a simple ptk program that puts up a
progress bar. Runs fine under both Perl 5.6.1 and 5.8.4.
outside the debugger. It also runs fine with the
standard perl5db.pl debugger under 5.6.1, but dies with
a 40-line exception under 5.8.4. I had run into a problem
doing any Tk debugging in Komodo, and found that the
Komodo debugger was stomping on $@ between the return
from the wrapped sub call, and the end of DB::sub --
that was an easy fix.
This one seems a little more complex. Any idea how
to fix it.
Here's the code -- just save it, and run from the
command-line with 'perl -d ...' and a 'c' -- no
breakpoints or stepping needed to trigger this bug.
# ---- 8-< ----
use Tk;
use Tk::ProgressBar;
my $mw = MainWindow->new(-title => 'ProgressBar example');
$progress = $mw->ProgressBar(
-width => 30,
-from => 0,
-to => 100,
-blocks => 50,
-colors => [0, 'green', 50, 'yellow', 80, 'red'],
-variable => \$percent_done
)->pack(-fill => 'x');
$mw->Button(-text => 'Go!', -command=> sub {
for ( $i = 0; $i < 1000; $i++ ){
$percent_done = $i/10;
print "$i\n";
$mw->update; # to see how far we are...
}
})->pack(-side => 'bottom');
MainLoop;
# ---- >-8 ----
Thanks,
Eric
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
|