[Petal] Bug report: Dollar follwed by a name gets lost

Thedi Gerber gerber at id.ethz.ch
Thu Aug 21 06:48:07 BST 2008


We are currently starting a new project and would like to use Petal. While doing some exercises to 
get to know it, i tried to include a small example perl script in a template. To my surprise, 
variable names in the perl source were lost.

After some more tests, I came to this conclusion:

$variable                         IN THE template magically disappears
$1000                             is ok
$n                                is ok (single letter following a $)
<span tal:content="xx">...</span> replaces the content always ok



Here is a small example:

---------------------------------- my template:
<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>

---------------------------------- my perl script

#!/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 get this output (missing <b>$nn</b>)


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



More information about the Petal mailing list