[Html-widget] Bug on select options(undef)?

Carl Franks fireartist at gmail.com
Mon Oct 16 16:43:26 CEST 2006


On 10/10/06, Ted Carnahan <ted at tedcarnahan.com> wrote:
> We've found an inconvenient bit of behavior, but we're not quite sure
> how to handle it.  On Selects, using attribute chaining, if you
> (inadvertantly) set options to undef, then the object returned out of
> Class::Accessor::Chained::Fast is the value of the options field
> (undef), instead of the reference to the element.

Do you mean you are passing the undef value, or an empty list?
->options( undef );
->options( );

How does this come about inadvertantly? ;)

> That seems like
> useful behavior in general (passing undef is like not passing any
> options, so you would want it to return the current value), but is
> supremely annoying in this case (we end up putting our calls to options
> last in the list so that they can't muck anything up).  Any ideas?

Don't call it unless you need to...

my $e = $w->element( Select => 'foo' )
->other()
->chained()
->methods();

$e->options( @opts ) if @opts;

Carl



More information about the Html-widget mailing list