---
name: "webtool"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:17.3-dfsg-4+deb8u2"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/webtool"
---

# webtool(3erl)

WebTool is a tool used to simplify the implementation of web based tools with Erlang/OTP.

## NAME

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

## DESCRIPTION

WebTool makes it easy to use web based tools with Erlang/OTP. WebTool configures and starts the webserver httpd.

## EXPORTS

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

Start WebTool with default data, i.e. port 8888, ip-number 127.0.0.1, and server-name *localhost*. If port 8888 is in use, port 8889 is tried instead. If 8889 is also in use, 8890 is tried and so on. Max number of ports tried is 256.

The *mime.types* file and WebTool's own HTML files are assumed to be in the directory *webtool-\<vsn\>/priv/root/conf*.

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

Types:

Path = string() \| standard\_path\
 Data = \[Port,Address,Name\] \| PortNumber \| standard\_data\
 Port = {port,PortNumber}\
 Address = {bind\_address,IpNumber}\
 Name = {server\_name,ServerName}\
 PortNumber = integer()\
 IpNumber = tuple(), e.g. {127,0,0,1}\
 ServerName = string()\
 Pid = pid()\

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

*Path* is the directory where the *mime.types* file and WebTool's own HTML files are located. By default this is *webtool-\<vsn\>/priv*, and in most cases there is no need to change this. If *Path* is set to *standard\_path* the default will be used.

If *Data* is set to *PortNumber*, the default data will be used for ip-number (*127.0.0.1*) and server name (*localhost*).

**stop()-\>void**\

Stop WebTool and the tools started by WebTool.

**debug\_app(Module)-\>void**\

Types:

Module = atom()\

Debug a WebTool application by tracing all functions in the given module which are called from WebTool.

**stop\_debug()-\>void**\

Stop the tracing started by *debug\_app/1*, and format the trace log.

## CALLBACK FUNCTIONS

The following callback function must be implemented by each web based tool that will be used via WebTool. When started, WebTool searches the Erlang code path for \*.tool files to locate all web based tools and their callback functions. See the **WebTool User's Guide** for more information about the \*.tool files.

## EXPORTS

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

Types:

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,child\_spec()}\

See the Reference Manual for the module supervisor in the STDLIB application for details about child\_spec().

Func = {func,{StartMod,StartFunc,StartArg}, {StopMod,StopFunc,StopArg}}\
 AppName = StartMod = StartFunc = StopMod = StopFunc =atom()\
 StartArg = StopArg = \[term()\]\

This is the configuration function (*config\_func*) which must be stated in the *\*.tool* file.

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 tool.

## SEE ALSO

**[start\_webtool(1)](/start_webtool/1.md)**, **WebTool User's Guide**
