next up previous contents index PLPL moodlepserratamodulosperlmonksperldocapuntes LHPgoogleetsiiullpcgull
Sig: Mas sobre listas Sup: Análisis Sintáctico con Regexp::Grammars Ant: Destilación del resultado Err: Si hallas una errata ...

Llamadas privadas a subreglas y subreglas privadas

If a rule name (or an alias) begins with an underscore:

     <_RULENAME>       <_ALIAS=RULENAME>  
    <[_RULENAME]>     <[_ALIAS=RULENAME]>

then matching proceeds as normal, and any result that is returned is stored in the current result-hash in the usual way.

However, when any rule finishes (and just before it returns) it first filters its result-hash, removing any entries whose keys begin with an underscore. This means that any subrule with an underscored name (or with an underscored alias) remembers its result, but only until the end of the current rule. Its results are effectively private to the current rule.

This is especially useful in conjunction with result distillation.


next up previous contents index PLPL moodlepserratamodulosperlmonksperldocapuntes LHPgoogleetsiiullpcgull
Sig: Mas sobre listas Sup: Análisis Sintáctico con Regexp::Grammars Ant: Destilación del resultado Err: Si hallas una errata ...
Casiano Rodríguez León
2013-03-05