Menu

#41 method val returns *undef* in list context

closed
nobody
None
5
2012-10-05
2003-07-08
Martin Kok
No

When there is no value defined for a parameter the
method "val" always returns undef. If val was called
in list context the result will be a list with one
element (undef) instead of an empty list.

As a result you can not use the construction:
if (my @v = $cfg->val('x','y')) { ... }

Attached file shows the change

Discussion

  • Martin Kok

    Martin Kok - 2003-07-08

    config-inifile diff

     
  • Martin Kok

    Martin Kok - 2003-07-08

    config-inifile diff

     
  • Martin Kok

    Martin Kok - 2003-07-08

    Logged In: YES
    user_id=818417

    Oeps, looks like I overlooked the case of array context with
    a single value parameter. FIxed in new diff.

     
  • Shlomi Fish

    Shlomi Fish - 2008-10-29

    Thanks! Fixed in SVN in revision 88 (along with a testcase that I wrote).

    Closing as fixed.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB