Skip Menu |

This queue is for tickets about the Curses-UI CPAN distribution.

Report information
The Basics
Id: 5609
Status: resolved
Worked: 5 min
Priority: 0/
Queue: Curses-UI

People
Owner: marcus [...] cpan.org
Requestors: ged-cpan [...] faeriemud.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.92
Fixed in: (no value)



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); }
I fixed this bug and added code to throw an error message if the added code is actually not a code reference. Fixed in CVS and in the next release.