[ic] strange encoding behavior [ -> [
postmaster at aucoindujeu.com
postmaster at aucoindujeu.com
Thu Feb 12 21:01:17 EST 2004
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 [ within
$cart_string with a the following line :
$cart_string =~ s/\[/[/g;
I'm using Interchange v4.9.8, I wonder if I'm not
patching something not the correct way. any idea ?
Thanks in advance,
Sébastien
More information about the interchange-users
mailing list