Subject: | Bug in callback-execution code |
Callbacks registered via UI::Curses::add_callback() do not execute correctly because the code that iterates over them is iterating over the 'id' associated with each callback instead of the CODE refs, leading to errors like:
Undefined subroutine &Curses::UI::log called at /usr/share/perl5/Curses/UI.pm line 378.
For callbacks registered like:
my $periodicLogger = sub { logmsg("Mark."); };
$ui->add_callback( log => $periodicLogger );
$ui->mainloop;
Patch that (I think) corrects this problem attached.
--- UI.pm 2004-02-27 07:33:06.000000000 -0800
+++ /usr/share/perl5/Curses/UI.pm 2004-03-09 15:48:24.000000000 -0800
@@ -374,7 +374,7 @@
}
# Execute added code
- foreach my $code (keys %{$this->{-added_code}}) {
+ foreach my $code (values %{$this->{-added_code}}) {
$code->($this);
}