[ic] How to use Variable in perl?

Mike Heins interchange-users@icdevgroup.org
Fri Jul 19 16:09:01 2002


Quoting Interchange User (inter@myoccasion.com):
> (sorry for the previous mail... accidentally pressed "send"  :P  )
> 
> I have a Variable definition in catalog.cfg, like this:
> Variable        GOLD    Gold
> 
> To use this variable in a html page, it's simply:
> Gold = __GOLD__
> 
> right?  But how can I use it in a perl block?  Eg, a snippet:
> 
> [perl arg="values scratch"]
>   $b = "";
>   $b .= "membership_type=";
>   $b .= "__GOLD__";
>   $Scratch->{b} = $b;
>   return;
> [/perl]
> [scratch b];
> 
> 
> Of course, the above perl block does not work.  What could be wrong?  
> I think this should be very simple, but I just couldn't figure that 
> out.
> 

The arg="values scratch" stuff no longer is needed. Try this:

[calc]
  $Scratch->{b} = "membership_type=$Variable->{GOLD}";
  return;
[/calc]
[scratch b]

This would work in ITL:

    [seti b]membership_type=__GOLD__[/seti]

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Unix version of an Outlook-style virus:
It works on the honor system. Please forward this message to everyone
you know, and delete a bunch of your files at random.