Akopia Akopia Services

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

Re: [mv] Performing [IF] on scratch variable.....



******    message to minivend-users from Dan Busarow <dan@dpcsys.com>     ******

On Fri, 25 Aug 2000, Barry Treahy, Jr. wrote:
> Dan Busarow wrote:
> > On Sat, 26 Aug 2000, Tal Hart (TelNET) wrote:
> > >  I am using a variable set with [set name var1]0[/set]
> > > the Var performs well, i use it within a serach as $var1....
> > >
> > > Now, i wish to perfrom an [IF] on this var1,
> > > and cant get it to work....
> > > i guess i dont have the right syntax......
> > > what should it be.... ????
> >
> > [if scratch var1] works for me.
> 
> I believe your example only confirms that var1 is defined, not that the contents of
> var1 happens to meet any type of regexp criteria.
> 
> I'm not a perl expert, but something like this might work:
> 
> [if explicit]
> [condition]
>   $tmpvar = $Safe{'scratch'}{'var1'};
>   return 0 if $tmpvar eq "0";
>   return 2;
> [/condition]
> var1 is not zero.
> [else]
> var1 is zero.
> [/else]
> [/if]

You're right.  My way is only testing to see if the variable has been
set.  But 0 is treated as false or unset.

Dan
-- 
 Dan Busarow                                                  949 443 4172
 Dana Point Communications, Inc.                            dan@dpcsys.com
 Dana Point, California  83 09 EF 59 E0 11 89 B4   8D 09 DB FD E1 DD 0C 82

-
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: