webtool(3)

MODULE
webtool - WebTool is a tool used to simplify the use of web based tools with Erlang/OTP.

DESCRIPTION

WebTool makes it easy to use web based tools with Erlang/OTP. WebTool configure and start the webserver httpd. If WebTool not has write access to it's priv directory copy it to another location and use webtool;start/2 to start WebTool.

EXPORTS

start()-> {ok,Pid}| {stop,Reason}

    Start WebTool with default, port 8888, ip-number 127.0.0.1, and server-name localhost. The configuration data is assumed to be in the directory webtool-vsn/priv.

start(Path,Data)->{ok,Pid}|{stop,Reason}

        *   Path = String()|standard_path

        *   Data = [Port,Address,Name]|standard_Data|PortNumber

        *   Port = {"Port",Portnr}

        *   Address = {"BindAddress",Ipnumber}

        *   Name = {"ServerName",ServerName}

        *   Portnr = Ipnumber = ServerName = String()

        *   PortNumber = integer()

        *   Pid = pid()

        *   Reason

    Use this function to start WebTool if the default port, ip-number,servername or path to the configuration data not can be used.

    If Data is set to PortNumber, the ip-number and server- name will be retreived by calling inet:gethostname/0 and inet:getaddr/2.

    If Path is set to standard_path the configuration data is assumed to be in the directory webtool-vsn/priv. If Data is set to standard_data the default port ip-number and servername is used.

stop()->void

    Stop WebTool and the tools started by WebTool.

CALLBACK FUNCTIONS

The following callback function must be implemented by each web based tool that will be used via WebTool. WebTool search the path for *.tool files to find the callback function, see WebTool user's Guide for more information.

EXPORTS

Module:Func(Data)-> {Name,WebData}|error

        *   Data = term

        *   Name = atom()

        *   WebData=[WebOptions]

        *   WebOptions = LinkData | Alias | Start

        *   LinkData = {web_data,{ToolName,Url}}

        *   Alias = {alias,{VirtualPath,RealPath}}| {alias{erl_alias,Path,[Modules]}

        *   Start = {start,StartData}

        *   ToolName = Url = VirtualPath = realPath = Path = string()

        *   Modules = atom()

        *   Startdata = AppData | ChildSpec | Func

        *   AppData = {app,AppName}

        *   ChildSpec = child_spec()

        *   Func = {{StartMod, StartFunc, StartArg}, {StopMod, StopFunc, StopArg}}

        *   AppName = StartMod = SartFunc = StopMod = StopFunc =atom()

        *   StartArg = StopArg = [term()]

        *

    The function is called by WebTool at startup to retrieve the data needed to start and configure the tool. LinkData is used by WebTool to create the link to the tool. Alias is used to create the aliases needed by the webserver. Start is used to start and stop the server.

    for more information about child_spec see supervisor:start_child/3.

See Also

WebTool User's Guide.

AUTHOR
Martin Gustafsson - support@erlang.ericsson.se