I found myself doing this [+ local $escmode=0; $varName +] as well, and I
have realized that setting it globally can change it for the entire page.
Really, though, this is not a good solution for me, because I want to go
back and forth between escaped and unescaped blocks often within the page.

I am already using Embperl in an arrangement where I don't call it directly,
but rather call Embperl::Execute as a method of an object I have written.
This puts me in the fortunate situation of being able to pre-process my HTML
code a bit before it goes to Embperl. I have used the following regular
expression there and it has worked quite well: (the file contents is read
into $data, which is later passed to Execute through the input argument)

$data =~ s/\[\=(.*?)\=\]/[+ local \$escmode = 0; $1 +]/gs;
 
This translates any [= mysub() =] blocks to [+ local $escmode=0; mysub() +].
This is very convenient for switching back and forth between escaped and
unescaped blocks. The '=' has mnemonic value, too.

At the risk of what I would term "tag bloat", perhaps a new processing tag
along these lines could be added in a future Embperl release. I have to
imagine that it would be very convenient for many people.

 - Kevin

-- 
Kevin Eye
Web Applications Developer
University at Buffalo
330 Crofts Hall
Buffalo, NY 14260
[EMAIL PROTECTED]
phone (716) 645-5000 x1435
fax (716) 645-2313


> From: "Gerald Richter" <[EMAIL PROTECTED]>
> Date: Tue, 28 Mar 2000 05:34:05 +0200
> To: "Eric Lowry" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Subject: RE: Syntax enhancement request
> 
> Hi,
>> 
>> My code tends to generate HTML, so I find myself writing this:
>> [+ $escmode=0; $varName +] all the time.
>> 
>> IMHO, this looks ugly, and will confuse the poor HTML coders I want to
>> hire. I have been thinking that another embperl  directive that turns
>> off escmode would be useful.  Something like [% $varName %] that would act
>> as shortcut for [+ $escmode=0; $varName +].  Has this come up
>> before?  What
>> is the price (usability/readability/performance/etc) of another bracket
>> escape sequence?
>> 
> 
> If you write the [- $escmode=0 -] it will turn off escaping until you reset
> it to another value. If you want to change it for just one block, you must
> say [+ local $escmode=0; $varName +]. If you need this $escmode = 0 in all
> your pages, simply put a
> 
> PerlSetEnv EMBPERL_ESCMODE 0
> 
> in your httpd.conf. Is that what you are looking for?
> 
> Gerald
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925151
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to