Re: Re: init/cleanup/shared/

Keats Kirsch <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
I'm not quite sure what you're getting at but if you want a deferred 
#include you can do this with #templet/#eval.  (#macro won't work since 
they are evaluated at build time.)

For example:

#templet $dynaIncl { \#include as template \$file }
#eval $dynaIncl using { "file": "myfile.wmt" }

With the newest version of #eval in CVS you can do this in one step:

#eval "\#include as template \$file" using { "file": "myfile.wmt" }

Note the need for backslashes to escape the # and $ chars.  Otherwise 
they will get evaluated prior to the #eval.

Hope this helps.

Keats

dinesh t b wrote:

>Trying to post it again, as it did not show up
>
>From: "Jason E. Stewart" <[email protected]>
>Sent: Monday, May 09, 2005 6:15 PM
>Subject: Re: init/cleanup/shared/
>
>
>  
>
>>"dinesh t b" <[email protected]> writes:
>>
>>    
>>
>>>#macro pantotoparse($file){
>>>
>>>this is the stuff that goes before the real parse
>>>
>>>#include as template $file
>>>
>>>and the clean up stuff after the parse
>>>
>>>}
>>>
>>>So we can use #pantotoparse("myfoo.wm") instead and we get what we want.
>>>
>>>However this does not compile as #include tries to expand immediately,
>>>and we cannot get the necessary "delay" that we want for the include.
>>>      
>>>
>>We should add that we're using the 2.0b of WebMacro.
>>
>>We tried using #eval with a #templet - but this too did not work -
>>the #include got executed at definition time, not at run time. Putting
>>the #include inside a string, inside the #eval didn't work either -
>>it never got executed - instead it just printed the string...
>>
>>Cheers,
>>jas.
>>    
>>



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.