Warning: strpos() [function.strpos]: Empty needle in /home/dealer/kasat/pkg/cahir/web/html/lib/plugins/translation2/action.php on line 53

Warning: Cannot modify header information - headers already sent by (output started at /home/dealer/kasat/pkg/cahir/web/html/lib/plugins/translation2/action.php:53) in /home/dealer/kasat/pkg/cahir/web/html/inc/actions.php on line 163
erlang:otp-app [Krystian Bacławski Wiki]
 

Aplikacje

Struktura katalogu

  • src/ – źródła w erlangowe,
  • ebin/ – zawiera skompilowane źródła erlangowe do plików beam i opis aplikacji w postaci pliku .app,
  • priv/ – zawiera wszystkie pliki specyficzne dla aplikacji; mogą to być pliki danych, pliki wykonywalne pochodzące z innych języków; należy używać code:priv_dir/1 aby znaleźć ścieżkę do tego katalogu;
  • include/ – pliki dołączane przez nasze źródła.

Makefile

all: src
 
src:
    make -C src
 
clean:
    make -C src clean
    @rm -vf erl_crash.dump
 
.PHONY: all src clean

src/Makefile

ERLC       = erlc
ERLC_FLAGS = -Wall -o ../ebin
 
MODULES=$(patsubst %.erl,%,$(wildcard *.erl))
 
all: modules
 
modules: $(MODULES:%=../ebin/%.beam)
 
../ebin/%.beam: %.erl
    $(ERLC) $(ERLC_FLAGS) $^
 
clean:
    @rm -vf $(MODULES:%=../ebin/%.beam)
 
.PHONY: all clean modules

Opis aplikacji

{application, Application,
  [{description,  Description},
   {id,           Id},
   {vsn,          Vsn},
   {modules,      Modules},
   {maxP,         MaxP},
   {maxT,         MaxT},
   {registered,   Names},
   {included_applications, Apps},
   {applications, Apps},
   {env,          Env},
   {mod,          Start},
   {start_phases, Phases}]}.
 
  Module = Name = App = Par = Phase = atom()
  Val = StartArgs = PhaseArgs = term()
Zmienna Typ Domyślna wartość
Application atom() -
Description string() ””
Id string() ””
Vsn string() ””
Modules [Module] []
MaxP int() infinity
MaxT int() infinity
Names [Name] []
Apps [App] []
Env [{Par,Val}] []
Start {Module,StartArgs} undefined
Phases [{Phase,PhaseArgs}] undefined

Funkcje zwrotne

Module:start(StartType, StartArgs) -> {ok, Pid} | {ok, Pid, State} | {error, Reason}
Module:start_phase(Phase, StartType, PhaseArgs) -> ok | {error, Reason}
Module:prep_stop(State) -> NewState
Module:stop(State)
Module:config_change(Changed, New, Removed) -> ok
  • normal
  • {takeover,Node}
  • {failover,Node}

Funkcje modułu application

application:get_all_env() -> Env
application:get_all_env(Application) -> Env
 
application:get_all_key() -> {ok, Keys} | []
application:get_all_key(Application) -> {ok, Keys} | undefined
 
application:get_application() -> {ok, Application} | undefined
application:get_application(Pid | Module) -> {ok, Application} | undefined
 
application:get_env(Par) -> {ok, Val} | undefined
application:get_env(Application, Par) -> {ok, Val} | undefined
 
application:get_key(Key) -> {ok, Val} | undefined
application:get_key(Application, Key) -> {ok, Val} | undefined
 
application:load(AppDescr) -> ok | {error, Reason}
application:load(AppDescr, Distributed) -> ok | {error, Reason}
 
application:loaded_applications() -> [{Application, Description, Vsn}]
 
application:permit(Application, Bool) -> ok | {error, Reason}
 
application:set_env(Application, Par, Val) -> ok
application:set_env(Application, Par, Val, Timeout) -> ok
 
application:start(Application) -> ok | {error, Reason}
application:start(Application, Type) -> ok | {error, Reason}
 
application:start_type() -> StartType | local | undefined
 
application:stop(Application) -> ok | {error, Reason}
 
application:takeover(Application, Type) -> ok | {error, Reason}
 
application:unload(Application) -> ok | {error, Reason}
 
application:unset_env(Application, Par) -> ok
application:unset_env(Application, Par, Timeout) -> ok
 
application:which_applications() -> [{Application, Description, Vsn}]
application:which_applications(Timeout) -> [{Application, Description, Vsn}]

Źródła

Artykuły:

Moduły:

Typy plików:

  • app - opis aplikacji
  • appup - opis procesu aktualizacji aplikacji
  • config - konfiguracja systemu
  • script - skrypt startujący system

Wydania

Źródła

 
erlang/otp-app.txt · Last modified: 2010/06/15 16:03 by Krystian Bacławski
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-No Derivative Works 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki