It all begins with the global parser
The global parser, which I discussed in previous chapters, creates cfrun
atoms. The cfrun
atoms are a single configuration line (for example, "add this user")
with the attached section and class-conditional execution. For
instance, "add user" would be in the "users" section, and perhaps it's
only for the "linux" classes.
The cfrun()
function executes these cfrun
atoms. Before the functional atoms are executed, however, cfrun()
needs to process the import
and group
statements. In a future version of cfperl, the imports may be done
conditionally, as in cfengine. In this version, imports are
unconditional.
|
|
See the sample configuration cftest.conf in the cfperl CVS repository or the cfengine sample configuration (both in the Resources
section) for an example of how imports work on the user side. In
cfperl, imports are processed by the top-level parser with the load_file()
function. Imports need to be executed first to simplify the program flow.
The control and groups sections are processed after imports but before user-side functionality atoms. The control: cfengine
section defines the actionsequence
and user-defined classes, for example. The actionsequence
declares what the order of cfengine/cfperl sections will be. Cfperl implements the actionsequence
with the cfqueue
atoms, which are inserted in an array called @cfrun_order
. The groups
section is necessary in order to declare the classes that cfengine/cfperl will interpret for conditional execution later.
The dispatch()
function takes a cfrun
atom and dispatches it to the appropriate secondary parser. I'll explain the group
section secondary parser and the empty default secondary parser later in this chapter.
View The road to better programming: Chapter 9. The classes and default parsers Discussion
Page: 1 2 3 4 5 6 Next Page: The default parser