[erlang-questions] separating application from gen server

Tom Whitcomb <>
Wed Nov 28 17:43:38 CET 2007


Ahhh. Perfect.  The application;get_application is just what I need.

Thanks.

tom

----- Original Message ----
> From: Ulf Wiger (TN/EAB) <>
> To: Tom Whitcomb <>
> Cc: 
> Sent: Wednesday, November 28, 2007 12:44:49 AM
> Subject: Re: [erlang-questions] separating application from gen server
> 
> Tom Whitcomb skrev:
> > Hi,
> > 
> > I want to use application:get_env in my gen_server but it feels wrong
> > to create a dependency between my gen_server and a
> specific
> 
 application.
> > 
> > Is there a recommended way for a gen_server to receive and reference
> > the application that contains it?
> 
> application:get_application() -> {ok, AppName} | undefined
> 
>    will return the name of the application which contains
>    the current process.
> 
> application:get_env(Par) -> {ok, Val} | undefined
> 
>    will get the environment variable Par from the current
>    application. get_env(AppName, Par) will get it from the
>    specified application.
> 
> 
> BR,
> Ulf W
> 





More information about the erlang-questions mailing list