You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Robert <ro...@robert.cz> on 2001/02/24 12:12:03 UTC

weirdness

Hi,

  in the following example first two cases work as expected while the
third generates 'tst.html?2/16' and the fourth 'tst.html?3'. I believe
this is a bug. I think I reported this a while ago but I don't remember
what was the result. This is Apache/1.3.14 (Unix) (Red-Hat/Linux)
mod_perl/1.23 HTML::Embperl 1.3.1.

- Robert



[-
	%fdat = ( par1 => 1, par2 => 2 );
-]

<body>

<a href="tst.html?[+ \%fdat +]">right</a>
<a href="tst.html?[+ { par3 => 3, %fdat } +]">right</a>
<a href="tst.html?[+ { %fdat } +]">wrong</a>
<a href="tst.html?[+ { %fdat, par3 => 3 } +]">wrong</a>

</body>

Re: weirdness

Posted by Gerald Richter <ri...@ecos.de>.
>
>   in the following example first two cases work as expected while the
> third generates 'tst.html?2/16' and the fourth 'tst.html?3'. I believe
> this is a bug. I think I reported this a while ago but I don't remember
> what was the result.

It's not a bug, it's simply because of the way Perl interprets your {}. In
the cases it get the wrong result, Perl interprets the { } as block (that
groups statements),  rather as anoymous hash. Just change it to the
following and it work:

 <a href="tst.html?[+ \%fdat +]">right</a>
 <a href="tst.html?[+ scalar ({ par3 => 3, %fdat }) +]">right</a>
 <a href="tst.html?[+ scalar ({ %fdat }) +]">not wrong anymore</a>
 <a href="tst.html?[+ scalar ({ %fdat, par3 => 3 }) +]">not wrong
anymore</a>

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