|
NAMElfescript - Lisp Flavoured Erlang (LFE) scripting supportSYNOPSISlfescript provides support for running short LFE programs without having to compile them first and an easy way to retrieve the command line arguments.EXPORTSscript-name script-arg1 script-arg2 ...lfescript lfescript-flags script-name script-arg1 script-arg2 ... lfescript runs a script written in LFE. lfescript:script_name() -> File Types:
The script_name/0 function returns the name of the lfescript being executed. If the function is invoked outside the context of an lfescript, the behavior is undefined. EXAMPLEHere follows an example script.
The header of the LFE script is different from a normal LFE module. The first line is an interpreter line which invokes lfescript if the script is run as in the first command line above. If lfescript is explicitly invoked in the second command line above then this header line will be ignored. On the second or third line it is possible to give arguments to the emulator with the syntax:
In the example the second line is an optional directive to Emacs which causes it to enter LFE mode when editing the script file. The rest of the file contains LFE source code. It must always the function main/1. When the script is run this function will be called with a list of strings representing the arguments with which the script was called. It is possible to define, include and use macros in the source code. The source code is checked and warnings and errors will be printed. If there are errors the script will not run and it will terminate with exit status 127. Otherwise the code will be interpreted. If the function main/1 returns successfully then the exit status for the script will be 0 but if an exception is raised then exit status will be 127. OPTIONSThe following option is accepted by lfescript
Unrecognised options are ignored. ENVIRONMENT VARIABLESLFESCRIPT_EMULATORThe command used to start the emulator. Default is 'erl'. This can be useful for passing arguments into the emulator, for example
will add the directory sune to the code path. SEE ALSOlfe(1), lfe_guide(7)AUTHORSRobert Virding.
Visit the GSP FreeBSD Man Page Interface. |