Skip Menu |

This queue is for tickets about the Petal CPAN distribution.

Report information
The Basics
Id: 35103
Status: open
Priority: 0/
Queue: Petal

People
Owner: Nobody in particular
Requestors: gerber [...] id.ethz.ch
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Thedi Gerber <thedi [...] ethz.ch>
Subject: Missing $ in Petal Output
Date: Wed, 16 Apr 2008 12:50:49 +0700
To: bug-Petal [...] rt.cpan.org
From: Thedi Gerber <gerber [...] id.ethz.ch>
I plan to use Petal for a new project in our university. We are very much impressed with this Module. But while testing it, I run over an unexplicable situation: If I have text in a template source which looks like a perl variable name: $varname this text will disapear when I execute the Petal process method. It does not disapear, if I use a tal:content="text_with_dollars" attribute to include it. It does not disapear, if it is just a one character name '$n' It does not disapear, if it is a number '$10' But this one will disapear: '$nn' Am I missing something? Regards Thedi gerber@id.ethz.ch ------------------------------------------------------------------------- Petal 2.19 Perl 5.8.8 Mac OSX 10.5 (Leopard) ------------------------------------------------------------------------- Here is an example (also included as attachments): t.tmpl contains --------------- <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://purl.org/petal/1.0/"> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"/> </head> <body> <p> 10 dollars are <b>$10</b>, n dollars are <b>$n</b>, but nn dollars disapear <b>$nn</b>! </p> </body> </html> t.pl contains ------------- #!/usr/bin/perl -w use strict; use utf8; binmode STDOUT, ':utf8'; use Petal; my $task = new Petal( file => 't.tmpl', output => 'HTML', # required to process &uuml; seqences OK ); my %content_data = ( ); my $task_result = $task->process( \%content_data ); print $task_result; print "\n", '=' x 50, "\n"; print "Petal::VERSION=", $Petal::VERSION, "\n"; print "\n", '=' x 50, "\n"; print `perl -V`; print "\n", '=' x 50, "\n"; I run it like this ------------------ thedi-gerbers-computer:~ thedi$ ./t.pl <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" /> </head> <body> <p> 10 dollars are <b>$10</b>, n dollars are <b>$n</b>, but nn dollars disapear <b></b>! </p> </body> </html> ================================================== Petal::VERSION=2.19 ================================================== Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=9.0, archname=darwin-thread-multi-2level uname='darwin omen.apple.com 9.0 darwin kernel version 9.0.0b5: mon sep 10 17:17:11 pdt 2007; root:xnu-1166.6~1release_ppc power macintosh ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include', optimize='-O3', cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include' ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc -mmacosx-version-min=10.5', ldflags ='-arch i386 -arch ppc -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-arch i386 -arch ppc -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Locally applied patches: fix for regcomp CVE-2007-5116 security vulnerability Built under darwin Compiled at Dec 7 2007 09:37:29 %ENV: PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin" @INC: /sw/lib/perl5 /sw/lib/perl5/darwin /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 . ================================================== thedi-gerbers-computer:~ thedi$
#!/usr/bin/perl -w use strict; use utf8; binmode STDOUT, ':utf8'; use Petal; my $task = new Petal( file => 't.tmpl', output => 'HTML', # required to process &uuml; seqences OK ); my %content_data = ( ); my $task_result = $task->process( \%content_data ); print $task_result; print "\n", '=' x 50, "\n"; print "Petal::VERSION=", $Petal::VERSION, "\n"; print "\n", '=' x 50, "\n"; print `perl -V`; print "\n", '=' x 50, "\n";

10 dollars are $10, n dollars are $n, but nn dollars disapear $nn!

This is actually an undocumented "feature". Petal turns all $anything expressions in the template code into something like <span tal:replace="anything"/>. Kind of defeats the whole purpose of having an XML based templateing language and I would very much like to get rid of it sometime.