Previous: , Up: Creating Packages   [Contents][Index]


38.4.4 Missing Components

If a package relies on a component, such as another Octave package, that may not be present it may be useful to install a function which informs users what to do when a particular component is missing. The function must be written by the package maintainer and registered with Octave using missing_component_hook.

Built-in Function: val = missing_component_hook ()
Built-in Function: old_val = missing_component_hook (new_val)
Built-in Function: missing_component_hook (new_val, "local")

Query or set the internal variable that specifies the function to call when a component of Octave is missing. This can be useful for packagers that may split the Octave installation into multiple sub-packages, for example, to provide a hint to users for how to install the missing components.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

The hook function is expected to be of the form

fcn (component)

Octave will call fcn with the name of the function that requires the component and a string describing the missing component. The hook function should return an error message to be displayed.

See also: missing_function_hook.