Module is a set of Pnuts scripts which can be utilized by applying the use() builtin function. A module corresponds to a package, in which functions of the module are defined.
The functions in Pnuts distribution are grouped into the following modules.
- pnuts::lib
- General purpose library
- pnuts::gui
- GUI library
- pnuts::util
- Utility functions
- pnuts::servlet
- Servlet library
- pnuts::regex
- Regular expression library
A module may depend on other modules. The dependency can be defined explicitly by a chain of use() call. For example, the relationship of the modules in Pnuts is as follows.
pnuts::servlet --> pnuts::util +--> pnuts::gui ----> +----------------------> pnuts::lib +--> pnuts::regex ---->
The pnuts::util module depends on the pnuts::lib module. When pnuts::util is registered by calling use(), pnuts::lib is automatically registered by a subsequent use() call.
Custom modules of Pnuts can be made in the following steps.
use("pnuts::lib")
When autoload() is not defined, require("init") is needed. For example, when use("pnuts::lib") is not called directly or indirectly, autoload() is not defined.require("init") autoload("play", "acme/util/cdplayer")