Developer Forums | About Us | Site Map
Search  
HOME > TUTORIALS > SERVER SIDE CODING > PERL TUTORIALS > THE ROAD TO BETTER PROGRAMMING: CHAPTER 7. TOP LEVEL CONTROL FLOW


Sponsors





Useful Lists

Web Host
site hosted by netplex

Online Manuals

The road to better programming: Chapter 7. Top-level control flow
By Teodor Zlatanov - 2004-03-15 Page:  1 2 3 4 5

The control flow

The cfperl control flow is summarized briefly in the POD section of cfperl itself.

Listing 6. cfperl control flow documentation

        
First, a top-level parser is applied, preprocessing everything into a
cfrun queue (a queue of actions, tagged with a section and some classes).

Second, the 'import', 'control' and 'groups' sections are parsed (first
the imports, then the control and group statements).  The actionsequence
(called a cfqueue) is defined. 

Third, the remaining statements (everything not processed in the second
step) are processed. 

The functions that handle these steps are:

  • Top-level parser: parse_line()
  • Import: load_file()
  • Control and groups: dispatch()
  • All other sections: dispatch()

All these steps except the top-level parsing are done inside cfrun(). In effect, cfrun() is the actual interpreter, whereas parse_line() is the preparation phase that sorts out sections and imports. Imports have to be done before interpretation, because their contents may affect interpretation.

Note that the documentation of the control flow is inside the program itself! It is stated in fairly simple terms, which should be understandable to someone experienced with cfengine.



View The road to better programming: Chapter 7. Top-level control flow Discussion

Page:  1 2 3 4 5 Next Page: Command-line switches and other configuration options

First published by IBM developerWorks


Copyright 2004-2024 GrindingGears.com. All rights reserved.
Article copyright and all rights retained by the author.