September 2013
Intermediate to advanced
548 pages
12h 25m
English
I’m going to throw you in at the deep end. Here’s the simple
three-point plan for writing a gen_server callback module:
Decide on a callback module name.
Write the interface functions.
Write the six required callback functions in the callback module.
This is really easy. Don’t think—just follow the plan!
We’re going to make a simple payment system. We’ll call
the module my_bank.
We’ll define five interface routines, all in the module
my_bank.
start()Open the bank.
stop()Close the bank.
new_account(Who)Create a new account.
deposit(Who, Amount)Put money in the bank.
withdraw(Who, Amount)Take money out, if in credit.
Each of these ...
Read now
Unlock full access