You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Ian Van Der Poel <iv...@dlwc.nsw.gov.au> on 2001/05/03 07:48:08 UTC

Escape Mode displays value.

The following line of code works in 1.3 but gives a syntax error in 2

  [+ local $escmode = 0; $searchlist +]

I changed it to 

  [+ local $escmode = 0 +]
  [+ $searchlist +]

and this works but it displays the "0" in the output page. Has this format changed for version 2.

Regards

IAN




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Escape Mode displays value.

Posted by Gerald Richter <ri...@ecos.de>.

>The following line of code works in 1.3 but gives a syntax error in 2
>
>  [+ local $escmode = 0; $searchlist +]

For performace reasons, 2.0 allows only valid Perl expression inside a [+ +]
block (see README.v2), just rewrite it as

[+ do { local $escmode = 0; $searchlist } +]

and it should work again.

>I changed it to
>
>  [+ local $escmode = 0 +]
>  [+ $searchlist +]
>
>and this works but it displays the "0" in the output page. Has this format
changed for version 2.

Yes, because [+ +] will always output the result of the expression (here
$escmode). Additionaly $escmode will not correctly set in the next block to
zero or it will set for the rest of the page (I am not quite sure what Perl
does with the local inside an expression)

Gerald



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org




-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org