in reply to CFML Parser - testing. Design/Implementation suggestions.

I was playing with your test page and was confused at first about what the Template Variables field was for. Then I read your post more carefully and found the bit about 'global' variables.

After seeing a couple of examples of templates elsewhere, I modified your default template to look so:

Hello World! Welcome, <cfoutput query='bar'>#foo_name#</cfoutput>! <cfoutput>Math result = #res#</cfoutput>
For those who haven't seen the default template, I removed the first two lines that initialize the template variables foo_name and res. I then used the following in the Template Variables field: foo_name="Jim",res=5**3 I noticed that the res value was not calculated in the Parser Output window:
Hello World! Welcome, "Jim"! Math result = 5**3
What function or syntax would be necessary necessary in the template to cause it to interpolate the expression? Apologies if this is a silly question, but I don't know anything about Cold Fusion though I found your post interesting and as a nutty but wise monk once chided me:
"testers" can't hurt ;)(and usually, they learn something)
Touché.

--Jim

Replies are listed 'Best First'.
Re: Re: CFML Parser - testing. Design/Implementation suggestions.
by vladb (Vicar) on Jan 02, 2002 at 06:35 UTC
    Thanks for your question ;-). There's nothing wrong with your quest, and I deeply appreciate your curiosity. ;D.

    The probelm with my current template parser is that the I use standard Perl eval() for expressions at the moment and _only_ if you set a variable via <CFSET> tag. Setting a variable via parameter list (the test page) is equivalent to this assignment in perl:
    $foo_var = 'foobar';

    If done via CFSET however, the expression should be evaluated, since that's how CFSET handler class was coded to perform.
    Whilst Perl eval()'s enough for testing, there'll have to be a CFML compatible eval() in place in order for this to work well. In many respects Perl eval() would be similar to CFML eval.

    "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith