On Sun, 11 Jul 2004, [EMAIL PROTECTED] wrote: > The question here is that I'd like to be able to evaluate the above > statements by passing in some values for num_oranges, num_apples, > has_override, etc. Idealy, I'd like to be able to give it a hashref > with all of these variables and then have PRD spit out true or false > for the final result. I was thinking about using the $arg facility and > calling it as such: > my $result = $parser->start($expression, 1, $parameters); > but passing $arg around seems to be a fairly messy way to do this. In > fact, do I even want to be attempting to evaluate this from within > PRD, or should I be building a parsetree and doing it separately? > Some guidance would be appreciated. Thanks.
You can do this at parse time, but it's better to build a symbolic parse tree and evaluate it later IMHO. See my cfperl package http://lifelogs.com/cfperl for a sample implementation. (I think this was recently discussed on this list, too) Ted