[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Ow!! || bit me



Code:

  $res->set_child_qty    ($cookie->{child_qty} ||
$q->param('child_qty'));


When:

  $cookie->{child_qty}     is 0
       and
  $q->param('child_qty')   is undef


Then:

  I'm running   $res->set_child_qty(undef)

which is NOT what I wanted.


Doh! I need Perl 6's // operator! -grin-


New code:

  if (defined $cookie->{child_qty}) {
     $res->set_child_qty($cookie->{child_qty}) 
  } else {
     $res->set_child_qty($q->param('child_qty'))      
  }


Eww... Long and ugly. But it does do what I want and 0 is a valid value
for child_qty. 

$live && $learn++;

j