You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Tom Johnes <ep...@yahoo.com> on 2001/12/31 06:57:30 UTC

Error in dynamic tables

Good day,

[ I am not subscribed to the list. Please CC me in any
  replies. ]

Sorry to bother you. I am new to Embperl. Maybe this
has been addressed before, but I did not find it in
the documentation, the archives, or via a web search
engine.

I am developing a page that makes use of a dynamic
table. I am using an array reference. Each element in
the array is an object. Thus, I coded something along
the lines of:

<table>
<tr><td> $arrayref->[$row]->method </td></tr>
</table>

The problem is that this results in an error in the
log  of "Can't call method "method" on an undefined
value". I would have expected it to work. I thought
Embperl would have parse the expression an extracted
"$arrayref->[$row]", determined whether it results in
an undefined value, and stopped or continued based on
that result.

Instead is appears embperl evaluates the whole
expression resulting in the perl error before it
decides whether insert a table row. I had to modify
the code to something like:

<table>
<tr><td> $arrayref->[$row] ? $arrayref->[$row]->method
: ''</td></tr>
</table>

which results in correct output but is rather
cumbersome.

Is this a known issue? Is there a cleaner workaround?

Thanks.



__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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


Re: Error in dynamic tables

Posted by Gerald Richter <ri...@ecos.de>.
>
> <table>
> <tr><td> $arrayref->[$row]->method </td></tr>
> </table>
>
> The problem is that this results in an error in the
> log  of "Can't call method "method" on an undefined
> value". I would have expected it to work. I thought
> Embperl would have parse the expression an extracted
> "$arrayref->[$row]", determined whether it results in
> an undefined value, and stopped or continued based on
> that result.
>

Embperl only checks if the result of the whole expression is undefind.
Embperl never parses the expression (this would be nearly undoable without
reimplementing Perl itself), but Embperl 1.3.x ignores such errors (also
they get written to the log file) and continues to work as expected. Embperl
2.0 is at the moment not able to handle this correctly and will abort with
an error page (this will change in one of the next betas)

Gerald


-------------------------------------------------------------
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