[Dbix-class] DBIx::Class::HTMLWidget (checkboxes)

Dennis Schön ds at 1d10t.de
Fri Jul 14 12:29:18 CEST 2006


Ash Berlin wrote:
> Dennis Schön wrote:
>> I narrowed the problem down to the following code in HTMLWidget.pm line 43:
>>
>> my %cb = map {$_->name => undef if 
>> $_->isa('HTML::Widget::Element::Checkbox')} @{ $result->{_elements} };
>>
>> [the %cb hash ought to contain the checkbox names as keys]
>>
>> I replaced that line with the not so fancy, but for me working:
>> my %cb;
>> foreach (@{ $result->{_elements} }) {
>>      if ( $_->isa('HTML::Widget::Element::Checkbox') ) {
>>          $cb{$_->name} = undef;
>>      }
>> }
>>

> Could you test the latest SVN version? 
> http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class-HTMLWidget/
> 
> I know there have been a lot of changes to the CB code. Let us know how 
> the SVN version copes with you checkboxes.

Still no success. :-( I tried to debug a bit but unfortunatly i don't 
really understand whats going on. Especially the "$result->{_embedded}".

      36     #   find all checkboxes
      37     my @elements;
      38 ····
      39     if ($result->{_embedded}) {
      40         my @widgets = @{ $result->{_embedded} || [] };
      41         foreach (@widgets) {
      42             push @elements, $_->get_elements();
      43         }
      44     } else {
      45         @elements = $result->elements;
      46     }
      47
      48     my %cb = map {$_->name => undef } grep { 
$_->isa('HTML::Widget::Element::Checkbox')}·
      49     @elements;

that is the relevant code in the latest svn version. In my case line 39 
returns true but "@widgets" is empty -> which results in an empty "%cb".

Again, if i replace all this code with my snippet from above everything 
is working.

Dennis

-- 
"... [it is] something unearthly ... If there are sentient beings
on other planets, then they play Go."
- Emanuel Lasker, chess grandmaster



More information about the Dbix-class mailing list