[ic] strange encoding behavior [ -> [

Stefan Hornburg racke at linuxia.de
Fri Feb 13 06:31:39 EST 2004


On Fri, 13 Feb 2004 03:01:17 +0100
postmaster at aucoindujeu.com wrote:

> I'm setting up the wishlist features based on the already
> existing Foundation saving cart feature. A long time ago
> (1999) Mike Heins posted the following code :
> 
> With the power of Perl....
> 
> UserTag wish-list Order username
> UserTag wish-list Routine <<EOR
> sub {
> 	my($username) = @_;
> 	my $cart_string;
> 	package Vend::Interpolate;
> 	return 'No wish list'
> 		unless $cart_string = tag_data('userdb', 'carts', $username);
> 	my $safe = new Safe;
> 	my $ref = $safe->reval($cart_string);
> 	return "Bad cart save." if $@;
> 	return "Bad cart save." unless ref $ref;
> 	my $list = $ref->{wish_list};
> 	my $item;
> 	my $out = '';
> 	foreach $item (@$list) {
> 		$out .= "Code: $item->{code}<BR>";
> 		$out .= "Item: ";
> 		$out .= tag_data('products','description', $item->{code});
> 		$out .= "<P>";
> 	}
> 	return 'Nothing in wish list.' unless $out;
> 	return $out;
> }
> EOR
> 
> Which is great but does't work for me if I'm not
> reverting the strange encoding of [ to &#91; within
> $cart_string with a the following line :
> 
> $cart_string =~ s/\&#91;/[/g;
> 
> I'm using Interchange v4.9.8, I wonder if I'm not
> patching something not the correct way. any idea ?

Nowadays the [userdb] tag provides methods to read carts from the database 
into a shopping cart and vice versa more easily.

Ciao
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list