AMF-Perl

 view release on metacpan or  search on metacpan

doc/examples/petmarket/petmarket/api/cartservice.pm  view on Meta::CPAN

196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
sub addCartItem
{
    my ($self, $cartid, $itemid, $quantity) = @_;
    $self->dbh->do("INSERT INTO cart_details SET cartid='$cartid', itemid='$itemid', quantity=$quantity");
    my $result = $self->getCartTotal($cartid);
    $result->{"itemoid"} = $itemid;
    return $result;
}
 
sub updateCartItem
{
    my ($self, $cartid, $itemid, $quantity) = @_;
    $self->deleteCartItem($cartid, $itemid);
    return $self->addCartItem($cartid, $itemid, $quantity);
}
 
sub deleteCartItem
{
    my ($self, $cartid, $itemid) = @_;
    $self->dbh->do("DELETE FROM cart_details WHERE cartid='$cartid' AND itemid='$itemid'");

doc/examples/petmarket/petmarket/api/userservice.pm  view on Meta::CPAN

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
    my $rowRef = $hash_ref->{$email};
 
    foreach my $field (@fields)
    {
        $result->{$field} = $rowRef->{$field};
    }
    $result->{useroid} = $email;
    return $result;
}
 
sub updateUser
{
    my ($self, $userObject) = @_;
 
    return 0 unless $self->authenticate($userObject->{"email"}, $userObject->{"password"});
 
    my $setString = "";
 
    my @setStringArray = map {"$_='".$userObject->{$_}."'"} @userFields;
    $setString = join ",", @setStringArray;



( run in 0.456 second using v1.01-cache-2.11-cpan-49f99fa48dc )