I need to design a shopping cart using perl such that the user gets clear idea of the goods he choose to buy. I thought of saving data of those items in a cookie. But i wonder how to update an already existing cookie each time an item is added. Is there any better way to design a cart/checkout page. Is there any perl module which makes my work easier?
Here is the snippet i tried out for updating cookie of cart
$cooki = $q->cookie('CART'); #retrieve cookie CART if already exists into var $cooki
$val2 = $cooki;
$val1 = $picid;
$cooki=$q->cookie(-name=>'CART',
-value =>["$val1"," $val2"],
-expires=>'+5m',
-path=>'/');
print $q->header(-cookie=>$cooki);
retrieval:
$cooki = $q->cookie('CART');
But it stores only the current id of the pic selected like for ex '45%20' i.e. 45 with a space and not multiple values like '45 12 16' . Where could i go wrong?