Introduction
Lava uses many object/class structures to modularise and confine the details of the implementation of various Vulcan tasks, as well as a few general functions that may be accessed without a class.
Generally, class names are prefixed with Lava::
or vulcan::
and have the first letter in each word capitalised, similarly for the general Lava functions.
The class data, and functions thereon, are accessed through the member functions, which have lowercase names, and are typically called by dereferencing (->
) an instance of a class. For example:
my $panel = new Lava::Panel(); $panel->text("Hello world"); $panel->execute("Greeting") or exit;
where
Lava::Panel
is the class name;
$panel
is an instance of the class;
text
is a member of the Lava::Panel
class, called by invoking the
$panel
instance of the class.
vulcan::
classes can be used outside of Vulcan whereas Lava::
classes are restricted for use within Vulcan.
The Lava Programming documentation shows optional arguments in square brackets []
. In many cases, the brackets following the function name are optional in Perl, as are the brackets surrounding the return values when only one value is ever returned.
For each class there is a special constructor function called new
. The syntax used to call these functions is slightly different, requiring the addition of the class name after the new
identifier.
Related topics