Skip Menu |

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

Report information
The Basics
Id: 6770
Status: resolved
Priority: 0/
Queue: Curses-UI

People
Owner: Nobody in particular
Requestors: domi [...] komarr.grenoble.hp.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.93
Fixed in: (no value)



Subject: Curses::UI::Listbox::values expect array ref instead of list
According to doc, values method expects a LIST. But the code expect an array ref. (BTW, function prototypes are useless for methods, perl don't check them when called as methods) Here's a patch to accept either (array_ref | list) Cheers
diff -Naur Curses/UI/Listbox.pm Curses-new/UI/Listbox.pm --- Curses/UI/Listbox.pm 2004-02-16 15:27:03.000000000 +0100 +++ Curses-new/UI/Listbox.pm 2004-06-28 15:40:06.000000000 +0200 @@ -141,10 +141,10 @@ sub onSelectionChange(;$) { shift()->set_event('-onselchange', shift()) }; -sub values(;$) +sub values { my $this = shift; - my $values = shift; + my $values = ref $_[0] ? $_[0] : [ @_ ] ; # Clear and go to first item if we get new data $this->clear_selection(); @@ -157,6 +157,9 @@ # no values in it. $this->focusable(scalar(@{$values})); } + else { + die "Curses::UI::Lisbox->values: expected array ref or list"; + } return $this->{-values} }
thanks, applied