[ic] globalsub broken when implementing CommonAdjust

Russ Mann interchange-users@interchange.redhat.com
Mon Jan 21 23:58:01 2002


Hello List,

I've been using a global sub for quite a while to do some math and return
the percentage of savings a user is getting on a product:

GlobalSub <<EndOfSub
sub you_save_percent {
my($retail, $price) = @_;
my($yousave);
if (($retail > 0)&&($price > 0))
{
$yousave = ((1-($price/$retail))*100)+.5001;
$yousave = int($yousave);
$yousave .= "\%";
}
  return $yousave;
}
EndOfSub

This is called like this:
[perl arg=sub interpolate=1] you_save_percent ([item-field retail],
[item-field price])[/perl]

I just switched to using CommonAdjust because I want to take advantage of
the price group feature.  For some reason this broke the Global Sub.

I get this error:

63.14.69.58 zAD78XEt:63.14.69.58 - [21/January/2002:20:31:41 -0800] catalog
/store/catalog/BP050.html Safe: Unable to create sub named
"*MVSAFE55822::you_save_percent" at (eval 433) line 1.

 you_save_percent (14.95, 12.70)


Any ideas?

-Russ