Hi.
>
> I've noticed strange behavior when I mix the [$ $] and [* *] operators in
> Embperl code.
>
> I had the following code:
>
> --
> [$ if ($#$dat >= 0) $]
> <hr>
> <b>Links: [+ $#$dat +]</b><br>
>
> <table cellspacing=5>
>  [* foreach $row (@$dat) { *]
>     <tr> <td>
>     <a href="[+ $page_url +]?shownode=[+ $row->[4] +]">[+ $row->[1]
> +]</a>:
>     [+ $row->[2] +]<br>
>     </td></tr>
>  [* } *]
> </table>
>
> [$ endif $][# Links #]
> --
>
> The problem was that sometimes even when $#$dat = -1 ($dat is a ref to
> SELECT result from DBI) the block was executed. A reload - and it doesn't
> execute anymore.
>
> I changed [$ $] to [* *] operators and everything started to work
> correctly.
>

Replacing [* foreach *] with [$ foreach ... $] [$ endforeach $] will also
work.

You can't currently mix [$ $] and [* *] control structs in one page. That's
a bug in Embperl and I am working on it to fix it, but it's still work left
until it is fixed. So until a fixed release is available, please use only
one of them.

Gerald

Reply via email to