Forum: Cfengine Help
Subject: Re: Questions about the reference manual
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,18107,18136#msg-18136


1. depth_search => urecurse("inf");
2. 
3. body depth_search urecurse(d)
4. {
5. depth => "${d}";
6. exclude_dirs => { "\.svn", "\.git" };
7. }

Line 1 is from a promise.  Parts of a promise are comprised of external body 
parts.  At first this seems like spaghetti programming but this actually allows 
for lots of code to be reused.

Line 3 started the body part of the depth_search type specifically named 
urecurse.  This name could be anything.  (d) names the variable that is passed 
from line 1, the string 'inf'.  This is similar to passing variables to 
functions and subroutines in programming languages.

Line 5 sets the depth of the recursion, in this case infinite.

Line 6 tells the recursion to exclude directories names .svn and .git.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to