Mailing List Archive

Mismatched [] tags
I just finished finding a _tiny_ bug in my code that took a long time.

I had something like this:

[$ while ($id, $name, $status_id) = $sth->fetchrow_array $]
<tr>
<td>[+ $id +]</td>
[$ if ($status_id == 7) $]
<id>just some normal text</td>
[$ else $]
<id>[+bar +}</td>
[$ endif $]
<td>[+ $name +]</td>
</tr>
[$ endwhile $]

See the mismatched [+ +} bracket... it took me serveral hours to find that
one... I use strict all the time, but this gave no errors.

What do we call this? mis-feature? feature? bug? me not understanding how
embperl works?

Regards,

Wim Kerkhoff, Software Engineer
NetMaster Networking Solutions
wim@netmaster.com
RE: Mismatched [] tags [ In reply to ]
>
> See the mismatched [.+ +} bracket... it took me serveral hours to find that
> one... I use strict all the time, but this gave no errors.
>
> What do we call this? mis-feature? feature? bug? me not understanding how
> embperl works?
>

It takes the

bar +}</td>
[$ endif $]
<td>[.+ $name

block and if you don't have specified optRawInput, it removes all html tags,
so we have

bar +}
[$ endif $]
[+ $name

and then feed's it to the Perl interpreter. As long as this is valied Perl
code, you don't get an error. I don't think that the above is valid Perl
code, so you should see an error from the Perl interpreter. If you want to
know the step's that EMbperl takes on your source look at the section
"Inside Embperl" in the docs.

I don't like to call it mis-feature or bug, it's simply not possible, to
catch all combinations, as long as we are not using valid XML (or something
similar), which would us require to write &lt; in the Perl code all the time
when we mean < etc. Embperl tries to be smart to find out what the writer of
the source want's, but this isn't possible all the time (e.g. [$ and [+
could be valid Perl code in some situations, we can't tell this without
parsing the Perl code).

Gerald

P.S. In such situations, always look into the embperl logfile, which is able
to tell you how the code looks like that Embperl feeds to the Perl
interpreter, than you had quickly seen, that it was the wrong code.






> Regards,
>
> Wim Kerkhoff, Software Engineer
> NetMaster Networking Solutions
> wim@netmaster.com
>
> ---------------------------------------------------------------------
> 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 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
RE: Mismatched [] tags [ In reply to ]
Ok,

Thanks,

I was just wondering...

Makes sense...

On 10-May-2000 Gerald Richter wrote:
>>
>> See the mismatched [.+ +} bracket... it took me serveral hours to find that
>> one... I use strict all the time, but this gave no errors.
>>
>> What do we call this? mis-feature? feature? bug? me not understanding how
>> embperl works?
>>
>
> It takes the
>
> bar +}</td>
> [$ endif $]
> <td>[.+ $name
>
> block and if you don't have specified optRawInput, it removes all html tags,
> so we have
>
> bar +}
> [$ endif $]
> [+ $name
>
> and then feed's it to the Perl interpreter. As long as this is valied Perl
> code, you don't get an error. I don't think that the above is valid Perl
> code, so you should see an error from the Perl interpreter. If you want to
> know the step's that EMbperl takes on your source look at the section
> "Inside Embperl" in the docs.
>
> I don't like to call it mis-feature or bug, it's simply not possible, to
> catch all combinations, as long as we are not using valid XML (or something
> similar), which would us require to write &lt; in the Perl code all the time
> when we mean < etc. Embperl tries to be smart to find out what the writer of
> the source want's, but this isn't possible all the time (e.g. [$ and [+
> could be valid Perl code in some situations, we can't tell this without
> parsing the Perl code).
>
> Gerald
>
> P.S. In such situations, always look into the embperl logfile, which is able
> to tell you how the code looks like that Embperl feeds to the Perl
> interpreter, than you had quickly seen, that it was the wrong code.
>

Regards,

Wim Kerkhoff, Software Engineer
NetMaster Networking Solutions
wim@netmaster.com