Miscellaneous commands

web::match

web::match result listToBeSearched searchFor

In case searchFor exists in listToBeSearched, web::match returns result, otherwise an empty string.

web::match treats listToBeSearched as a list. Thus, web::match "ok" {tv dvd vcr} dvd will return ok.

web::tempfile

web::tempfile ?options?

Options are -path path, -prefix prefix, and -remove.

web::tempfile ?-path path ? ?-prefix prefix ?

Returns a unique name of a temporary file in the default temp directory or the directory given with path. The name can be prefixed with prefix. The maximum of guaranteed unique names per application is system dependent. This command just returns the name of a file. It is the programmers job to handle the file, for example to open it. Note that Websh keeps an internal list of all file names generated with web::tempfile and will attempt to delete all files when the interpreter dies.

web::tempfile -remove

Attempts to clean up all temporary files previously created using web::tempfile and resets the internal list of these file names.