Akopia Akopia Services

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

Re: [mv] Flustered with [if]



******    message to minivend-users from Mike Heins <mikeh@minivend.com>     ******

Quoting Nick Pleis (npleis@saratogaweb.com):
> Hey,
> 
> 
> The biggest single problem i've had with minivend has been getting the various IF's to work properly. (i've been at this about a year now) 
> 
> The documentation makes very little sense to me..can someone explain to me the semnatics of the IF statement?
> 
> It seems to me if I have a scratch variable (call it "mv_var") set to "test" and do:
> 
> [if scratch mv_var eq "test"] 
> that should work..
> or at leaset
> 
> [if type=scratch term="mv_var" op="eq" compare="test"] should..but neither do..or sporadically at best. The biggest problems are in string comparisons. Numeric comparisons seem to always work flawlessly (IE setting the same variable to 1 and doing : [if scratch mv_var == 1] will return the right result). I find myself resorting down to perl for this more and more....
> 
> Sorry, i'm just a bit frusturated after fighting this yet again for far to long tonite.
> 

I can tell you the tests are done the same way every time. There are
enough catalog implementations around to prove that.

IF you are going to use "eq", which I almost never do, then you have
to make sure there is not trailing/leading whitespace. Do you use a 
word wrapping editor? People who do have problems with MV sometimes.
PICO is an absolute abomination as a programmers editor, as are any
of which willy-nilly wrap text.

Much better is to do something like:

    [if scratch var =~ /^\s*test\s*$/i]
	Yes.
    [/if]

which removes those problems.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Research is what I'm doing when I don't know what I'm doing.
-- Wernher Von Braun
-
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: