Hi, > > I am trying to use embperl v2.0b3 for setting up a website that I am > working on. I am trying to use the new Syntax modules to define > extended HTML tags that get substituted by embperl with equivalent real > HTML tags. E.g. I want to allow the IMG tag to take a special attribute > "file" which points to the location on the local filesystem of the image > file, and allows embperl to replace that with the correct width and > height attributes. I tried using _ep_sa to add the width and height > attributes to the document. However, only the first call to _ep_sa > seems to succeed. > Yes, that seems really a bug in Embperl 2.0b3. Embperl's internal tree storage tries to optimize memory usage by using a "copy on write" schema, that mean nodes that are not modified are passed thru from the source, while nodes that are modified copied before they are modified. This logic seems to fail if you set two attributes within one node. There are a few other problems with this logic I found, that are not occuring when you use the syntaxes that comes with Embperl but may occur when you define your own syntax as you do. For this reason I am planning to make some changes to that logic, so that is handled correctly. I hope to get this done during the next two weeks. I will send you a copy of the new version, so you can test it against your new syntax Gerald P.S. Please use the embperl mailing list for further discussion, so others can participate > I dug into the source code (epdom.c) and noticed that in the second call > to _ep_sa (which in turn ends up calling Element_selfSetSttribut() in > epdom.c:2654), the pNode object gets cloned (line 2698). The cloned > object does have the new attribute that the call to _ep_sa intended to > insert. However, when I return from the method and finally, the > document gets output, the second attribute is not printed. > > It is very possible that I might be totally missing something here since > I have been trying to figure out how the system works just by looking at > the code. Any help you can provide would be great! > > Thanks, > Yatin > > > P.S. Here's the code snippet that I tried using: > > $self->AddTag('img', undef, [ 'src', 'file' ], undef, > { > perlcode => '(undef,undef,undef,$tiw,$tih,undef) > = ::identify_image(%&\'file%); > if (defined $tiw && defined $tih) { > _ep_sa(%$n%, \'width\', $tiw); > _ep_sa(%$n%, \'height\', $tih); }', > }); > > ------------------------------------------------------------- Gerald Richter ecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice: +49 6133 925131 WWW: http://www.ecos.de Fax: +49 6133 925152 ------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]