Skip to content

tardisgallifrey/erlangapplication

Repository files navigation

An Erlang Tutorial Application

This is a do-nothing person database that only stores one person at a time, but it is an example of many things in Erlang and how to structure an Erlang application.

Each file is an Erlang module. Most handle only one task, even though they may have more than one function.

person -- A bash script to start the app.

person.erl -- The core module that creates and updates a "Person" object.

person_write.erl -- A module to save and load a Person from a file.

person_server.erl -- A module to 'serve' the Person data for query.

person_client.erl -- A module to query Person server for name and age.

getPerson.erl -- A module to ask the user for name and age of the Person.

person_main.erl -- A main module to coordinate the other modules for a user.

I worked on this with chatGPT to better understand how Erlang works to build an application. Though chatGPT provided some module code so that I could learn, much of it has been modified to fit my needs. person_main, getPerson, and person_write are completely my work.

You can test each module through the Erlang shell -- erl person.erl

This is not meant to be a detailed tutorial on the use of Erlang, so please refer to the Interwebs for that information.

Do chmod +x person to get the bash script working and you can start the app with ./person. It has a menu of choices to try out each thing you can do.

TODO: I need to learn more about Erlang io for files so I can store more names and retrieve by name.

As always, use at your own RISK.

About

An example app to show how Erlang modules work together.

Topics

Resources

License

Stars

Watchers

Forks

Contributors