MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Possible [value] Bug and Patch




Hi Everyone,

  I'm having a bit of trouble with the value tag.  This behavior
may be intentional, so I hesitate to label it a bug; I'd like to
know what you people think.

  If I assign 0 or '0' to a value, like this:

    $Safe{'values'}->{'wf_vActionNumLast'} = 0;
 
  Then the tag:
  
    [value wf_vActionNumLast] 

  results in the null string rather than the string '0'.   Assigning
any other number in the above code produces the correct output.

  This is due to how the tag_value routine checks for validity.
Line 2032 of Interpolate.pm looks like this:
   
    $value = $::Values->{$var} || '';

  This relies on perl's test for truth, which says that '0' or 0 
equals false.  When $::Values->{$var} evaluates false, the null string
is assigned to $value.
  
  I assume there must be some reason for this that I am not
aware of.  If not, I'd suggest changing that line to something
like:

    if (defined ($::Values->{$var}))
    {
      $value = $::Values->{$var};
    } else
    {
      $value = '';
    } 
  
  I intend to use this patch in my version, so I'd like to hear
if anyone has any reason NOT to make this change.  The Perl
gurus among you can probably come up with something more
compact.

  Thanks Much,

     Lee Nelson


Search for: Match: Format: Sort by: