Language::AttributeGrammar::Thunk - Delayed code logic
This is a four stage thunk.
stage 1: code unset stage 2: code set, unevaluated stage 3: code being evaluated stage 4: code evaluated and return value stored
new($class, ?$code, ?$attr, ?$at)
Creates a new thunk object. If $code, $attr, and $at are specified, initializes the object via set.
set
$thunk->set($code, $attr, $at)
Set the code for a thunk. $attr is the name of the attribute that this code is evaluating (for example "Cons:length") and $at is a description of the location at which the thunk was defined (for example "grammar.pl line 42"). Both of the latter two are only used for diagnostic purposes. This method is only valid when the thunk is in stage 1 (and it moves it to stage 2).
$thunk->get($attr, $at)
valuate a thunk. $attr is the name of the attribute that is being fetched, and $at is a description of the location at which it is being fetched. In stage 1 it fails because there is no code to evaluate, and in stage 3 it fails because this implies that an infinite loop would occur. After successful execution of this method, the thunk is in stage 4.
Language::AttributeGrammar, Data::Lazy
To install Language::AttributeGrammar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Language::AttributeGrammar
CPAN shell
perl -MCPAN -e shell install Language::AttributeGrammar
For more information on module installation, please visit the detailed CPAN module installation guide.