[ic] Safe Syntax - Routine

Russ Mann tech@khouse.org
Thu, 7 Dec 2000 17:19:18 -0700


Dear List,

I have a [perl] routine that I was using in MV 3.14-5, but it generates
errors in Interchange 4.6.0.
Does anyone know why this isn't working, or how to get it working?

Thanks

Russ


This is the routine, in the basket page:

[perl arg=scratch interpolate=1]
my $numoff;
my $totalbps = [calc]$totalbps[/calc];
if ($totalbps <= 2) { $numoff = 0; }
elsif (($totalbps >= 3) && ($totalbps <=9)) { $numoff = 1.96; }
elsif ($totalbps >= 10) { $numoff = 2.46; }
$discount_amount = $totalbps * $numoff;
$Safe{'scratch'}->{'discount_amount'} = $discount_amount;
$Safe{'scratch'}->{'numoff'} = $numoff;
return '';
[/perl]


Here's my error entry:

63.30.86.223 YeF5fEhT:63.30.86.47 - [07/December/2000:17:16:10 -0800] kh
/store/
kh/ord/basket.html Safe: syntax error at (eval 207) line 3, at EOF
>
>
> my $numoff;
> my $totalbps = ;
> if ($totalbps <= 2) { $numoff = 0; }
> elsif (($totalbps >= 3) && ($totalbps <=9)) { $numoff = 1.96; }
> elsif ($totalbps >= 10) { $numoff = 2.46; }
> $discount_amount = $totalbps * $numoff;
> $Safe{'scratch'}->{'discount_amount'} = $discount_amount;
> $Safe{'scratch'}->{'numoff'} = $numoff;
> return '';
>
>
63.30.86.223 YeF5fEhT:63.30.86.47 - [07/December/2000:17:16:10 -0800] kh
/store/
kh/ord/basket.html Safe: syntax error at (eval 209) line 2, at EOF
>
> $discount_amount =
>
63.30.86.223 YeF5fEhT:63.30.86.47 - [07/December/2000:17:16:10 -0800] kh
/store/
kh/ord/basket.html Safe: syntax error at (eval 211) line 2, at EOF
>
> $numoff =
>
63.30.86.223 YeF5fEhT:63.30.86.47 - [07/December/2000:17:16:10 -0800] kh
/store/
kh/ord/basket.html Runtime error: Can't call method "open_table" on an
undefined
 value at /home/interchange/interchange/lib/Vend/Data.pm line 789.

"Freedom is a fragile thing and is never more than one generation away from
extinction. It is not ours by inheritance; it must be fought for and
defended constantly by each generation, for it comes only once to a people.
Those who have known freedom, and then lost it, have never known it
again." --Ronald Reagan