# Create the cart my $cart = new Cart( type => 'DBI', id => $foo ); print "Cart's current total is: ", $cart->total_cost(); # Be sure we don't sell anything inappropriate! foreach my $item ( $cart->list_items ) { if ( $item->type eq 'adult' && $user->age < 18 ) { $cart->remove_item( $item ); } } $cart->save; print "Cart's new total is: ", $cart->total_cost();