[ic] Re: Syntax Question on Using Cart in UserTags (Perl)

C.B. Currier interchange-users@icdevgroup.org
Fri Sep 27 12:14:02 2002


> C.B. Currier writes:
>
> > Trying to do a loop through a cart inorder to do some SQL lookups.
> > Having a problem with the fact that I believe the cart is being
> passed in
> > but for what ever reason I cannot reference the array properly.
> > Any suggestions on the below mentioned code is greatly appreciated.
> > BTW: I am not necessarily getting an error, just not log string being
> > returned.
> >
> > C.B.
> >
> > Code:
> >
> > UserTag test_calc Routine <<EOF
> > sub {
> > 	my $itmcount = 0;
> > 	my $itmlst = "";
> > 	my $item = $Carts->{main};
> > 	foreach (@$item){
> > 		$itmcount++;
> >             $itmlst.= $item->{code};
>
> $item is the cart array, the item itself is $_. Good penalty
> for bad variable naming.
>
> Bye
>     Racke

I understand what you are saying however the Documentation suggests that
infact it is not $item which is the array but $Items.  In a use defined
routine I gather that I am dealing with a perl environment. Originally I
tried to formalize this byt using the [perl][/perl] tags but to no avail.
SO... I tried to pass the $Carts->{main} to a new variable. I am not passing
any variables on the call of this user tag so I would suspect that the $_
does not apply? Correct? Therefore within a perl environment within
interchange dont I need to reference the proper Perl like tags? That is waht
I have been doing. As per the Interchange documentation. I wrote straight
perl code that worked in regular perl but having the need to reference the
cart I have run into this problem.
And Thanks very much for the advice!

C.B.