% $Id$ -module(shoppinglistinclass). -export([init/0, handle/2, add/1,getList/0,clear/0]). % the ones on this line were added -import(server1, [rpc/2]). -import(lists, [reverse/1]). -define(SERVER, shoppinglist). %% Calls that clients can make on this server add(Item) -> rpc(?SERVER, {add, Item}). getList() -> {list_is, List} = rpc(?SERVER, getList), List. clear() -> rpc(?SERVER, clear). %% callback routines init() -> []. handle({add, Item}, State) -> {added, [Item|State]}; handle(getList, State) -> {{list_is, reverse(State)}, State}; handle(clear, _State) -> {cleared, []}.