[ic] Bug in $Tag->subtotal when items discounted?

Thomas J.M. Burton tom at globalfocusdm.com
Wed Nov 3 19:00:45 EST 2004


Jon Jensen wrote:
> On Wed, 3 Nov 2004, Thomas J.M. Burton wrote:
> 
> 
>>Adding AllowGlobal for the catalog, then using global=1 in my perl tag 
>>actually ended up causing the perl code to return nothing and, while 
>>eliminating the original error, gave me this instead:
>>
>>172.17.1.20 sUbLRNeD:172.17.1.20 - [03/November/2004:14:54:29 -0800] 
>>beads /cgi-bin/beads/gccode Safe: Bareword "main" not allowed while 
>>"strict subs" in use at (eval 969) line 2.
>> >
>> >
>> >   my $stotal = $Tag->subtotal( { name => main, noformat => 0, } );
>> >   return $stotal;
> 
> 
> The error message means exactly what it says: you're trying to use a 
> bareword in your Perl code, which isn't allowed with strict on. Try 
> instead:
> 
> my $stotal = $Tag->subtotal( { name => 'main', noformat => 0, } );
> 
> While you're at it, there are some other barewords in your code:
> 
> 
>>   my $gctot = $Tag->scratch(gc_total);
> 
> 
> Try instead:
> 
> my $gctot = $Tag->scratch('gc_total');
> 
> Although that should really be:
> 
> my $gctot = $Scratch->{gc_total};
> 
> 
>>   my $shipmode = $Tag->value(  { name => mv_shipmode, }  );
> 
> 
> Try:
> 
> my $shipmode = $Tag->value( { name => 'mv_shipmode', } );
> 
> And that should really be:
> 
> my $shipmode = $Values->{mv_shipmode};
> 
> Jon
> 
> 

Thanks Jon. I realized the bareword error after posting my last message. 
Fixed that, but still ditched the AllowGlobal idea since it sounds like 
that really shouldn't be used. What I ended up doing was turning my perl 
code into a usertag that has the subtotal as an input, called like so:

	[gc_shipping stot="[subtotal noformat=1]"]

That gets around the problem I was having of a non-discounted subtotal 
being called when using $Tag->subtotal in embedded perl.

Thanks,
Tom

_______________________________
Global Focus Digital Media, LLC
www.globalfocusdm.com


!DSPAM:4189738a242676090219528!



More information about the interchange-users mailing list