I was able to get the thing to at least run ... until I hit the Exit or Go buttons. The problem seems to be that the
ProgressBar code works with undefined items, and just ignores the errors, while the debugger does not ignore them.
The case in point is ProgressBar::variable
I will paste the original, that crashes in the debugger, and my fix.
sub variable {
my $c = shift;
my $oldvarref = $c->{'-variable'};
my $oldval = $$oldvarref if $oldvarref;
if(@_) {
my $varref = shift;
if ($oldvarref)
{
$c->traceVdelete($oldvarref);
}
$c->{'-variable'} = $varref;
$c->traceVariable($varref, 'w', sub { $c->value($_[1]) });
$$varref = $oldval;
_layoutRequest($c,2);
}
$oldval;
}
<\code>
<br>
Here is the fix<br>
<br>
<code>
sub variable {
my $c = shift;
my $oldvarref = "";
my $oldval = "";
if (defined($c->{'-variable'})) {
$oldvarref = $c->{'-variable'};
$oldval = $$oldvarref if $oldvarref;
}
if(@_) {
my $varref = shift;
$c->traceVdelete($oldvarref)
if (defined($oldvarref) and ($oldvarref ne ""));
$c->{'-variable'} = $varref;
$c->traceVariable($varref, 'w', sub { $c->value([1]) });
$$varref = $oldval if (defined($oldval) and ($oldval ne ""));
_layoutRequest($c,2);
}
return ($oldval) if (defined($oldval) and ($oldval ne ""));
}
This took way to long for me to find. Now I have a worse problem (again, only in the debugger).
It runs in that it pops up the progress bar, but when I click on either Exit or Go, it bombs.
I have traced it down to Tk::MainLoop where it does
DoOneEvent(0);
but I cannot trace from there. I am getting very nervous that Tk may have such unprotected
undefined items sprinkled about. That would spell doom for anyone wanting to use Tk ... and be
able to use the Perl debugger.
Someone ... please say it isn't so!
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.