[erlang-questions] about the use of parametrized modules

Max Lapshin <>
Sat Jan 15 19:23:10 CET 2011


I can tell why I use parameterized modules in erlyvideo.

This is list of module chain, where functions are called:

{rtmp_handlers, [apps_login, apps_streaming]}.

rtmp_session is calling in such manner:  Module:connect(Session, Funcall)

Now we need a configurable module:  auth_users_limit. It requires
somehow to store additional configuration variable: limit of users.
The easies solution for me seems to store it as a parameter for module:

{rtmp_handlers, [{auth_users_limit, 100}, apps_login, apps_streaming]}

After that nothing is changed in rtmp_session:
Module:connect(Session, Funcall), but Module now is just a tuple from
config: {auth_users_limit, 100}.

It happened to be very convenient.


More information about the erlang-questions mailing list