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

Aaron Crane dbix-class at aaroncrane.co.uk
Fri Jul 14 19:16:36 CEST 2006


A. Pagaltzis writes:
> So the right way to write that code “fancily” is thus:
> 
>     my %cb = map {
>         $_->isa( 'HTML::Widget::Element::Checkbox' )
>             ? ( $_->name => undef )
>             : ()
>     } @{ $result->{_elements} };

I think this is much easier to read:

  my %cb = map  { $_->name => undef }
           grep { $_->isa('HTML::Widget::Element::Checkbox') }
           @{ $result->{_elements} };

-- 
Aaron Crane



More information about the Dbix-class mailing list