in reply to Re: Re: Need some help to review code
in thread Need some help to review code
The part up front is this, correct?
elsif ($choice eq "update") # update shopping cart { update_cart ($cart_ref, param("quantity")); $page .= format_cart_html ($cart_ref, 1); }
Your upfront conditional calls the update_cart method (subroutine if you prefer), which in turn calls the method update.
sub update_cart { my ($cart_ref, $item_id, $qty) = @_; update ($cart_ref->{$item_id}->{qty} = $qty); }
That piece of code makes the assignment $cart_ref->{$item_id}->{qty} = $qty and then calls update with the value of $cart_ref->{$item_id}->{qty}. What I still don't see in your scratchpad is the subroutine "update." Is it part of your WebDB module or did you forget to include it. Somewhere in your code should be something like this:
sub update { # a bunch of code }
update: And err, you call update_cart and send it only two vars, $cart_ref and quantity; however, in the update_cart method, you say there are three parameters, $cart_ref, $item_id and $qty - thats a problem. -derby
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Need some help to review code
by hbradshaw (Novice) on Jan 10, 2003 at 13:59 UTC | |
|
Re: Re: Re: Re: Need some help to review code
by hbradshaw (Novice) on Jan 10, 2003 at 19:57 UTC |