in reply to Package variables and Parse::RecDescent
You don't, as you've declared $checksyntax as a lexical in the block enclosing init_parser. It's only visible to the code literally between the outer two {}'s in your example. You probably want to declare it with our $checksyntax, then it would be accessable as $TelnetClient::Functions::checksyntax elsewhere.
Addendum: An alternative to using package variables would be to implement some variant of the Builder pattern. You have a interface which your grammar calls when it recognizes chunks, and you pass different implementors of that interface (one which builds a syntax tree, the other which does nothing as just a check that the input is valid, etc.). Consult your copy of the GangOfFour book for more details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Package variables and Parse::RecDescent
by castaway (Parson) on Jan 07, 2003 at 21:58 UTC | |
by Fletch (Bishop) on Jan 08, 2003 at 04:23 UTC |