Akopia Akopia Services

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

[mv] [value] tag problem



******    message to minivend-users from Lee Nelson <jld123@pobox.com>     ******

Hello,

  I'm having a problem with the value tag reporting "" (the null
string) for values that are actually a numeric zero.

  I posted this problem last fall but never received an answer.
Would anyone care to comment?  Please see my old message
quoted below.

  Thanks,

    Lee Nelson

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
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: