[Petal] Bug report

William McKee william@knowmad.com
Wed, 21 Aug 2002 10:33:57 -0400


--Message-Boundary-3308
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

Jean-Michel,

I've discovered a bug in the XHTML parser which occurs when the canonical 
format is used within a document. I've attached the usual test script and 
template which shows this bug as well as the HTML comments bug we were 
discussing yesterday ad nauseum <g>.

Thanks,
William
-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications & Database Integration
 http://www.knowmad.com
 



--Message-Boundary-3308
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'test.cgi'

#!/usr/bin/perl
#
use strict;
use Petal;
use CGI::Carp qw/fatalsToBrowser/;

# Extend the list of modifiers
$Petal::Hash::MODIFIERS->{pg_true} = 'Petal::Hash::Postgres::TRUE';
$Petal::Hash::MODIFIERS->{pg_false} = 'Petal::Hash::Postgres::FALSE';

$ENV{PATH} = "/bin:/usr/bin";

my $template_file = 'test.tmpl';
$Petal::DISK_CACHE = 0;
$Petal::MEMORY_CACHE = 0;
$Petal::TAINT = 1;
$Petal::BASE_DIR = './';
$Petal::INPUT = "HTML";
$Petal::OUTPUT = "XHTML";
my $template = new Petal ($template_file);


my $hash = {
	error_message => "Kilroy was Here",
	first_name => "William",
	last_name => "McKee",
	email => 'william@knowmad.com',
	boolean => '1',
	pg_boolean => 't',
	pg_boolean_false => 'f',
	students => [ { student_id => '1',
					first_name => 'William',
					last_name => 'McKee',
					email => 'william@knowmad.com',
					},
				  { student_id => '2',
					  first_name => 'Elizabeth',
					  last_name => 'McKee',
					  email => 'elizabeth@knowmad.com',
					},
				],
};
my $html = $template->process($hash);
print "Content-type: text/html\n\n";
print $html;

--Message-Boundary-3308
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  test.tmpl
     Date:  21 Aug 2002, 10:38
     Size:  6291 bytes.
     Type:  Unknown

--Message-Boundary-3308
Content-type: Application/Octet-stream; name="test.tmpl"; type=Unknown
Content-disposition: attachment; filename="test.tmpl"
Content-transfer-encoding: BASE64

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLT8NCiMg
ICAgIFRlbXBsYXRlOiB0ZXN0LnRtcGwNCiMgICAgICBDcmVhdGVkOiAwNy0yMy0yMDAyDQoj
ICAgICBNb2RpZmllZDogMDgtMTQtMjAwMg0KIyAgICAgICBBdXRob3I6IHdsbQ0KIyAgRGVz
Y3JpcHRpb246IFRlbXBsYXRlIHRvIGRvIHRlcnJpYmxlIHRoaW5ncyB0byB0ZXN0IFBldGFs
IHRlbXBsYXRlIGxhbmd1YWdlLg0KLS0+DQo8IURPQ1RZUEUgaHRtbCBQVUJMSUMgIi0vL1cz
Qy8vRFREIFhIVE1MIDEuMCBUcmFuc2l0aW9uYWwvL0VOIg0KICAgICJodHRwOi8vd3d3Lncz
Lm9yZy9UUi94aHRtbDEvRFREL3hodG1sMS10cmFuc2l0aW9uYWwuZHRkIj4NCg0KPGh0bWwg
eG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPg0KICA8aGVhZD4NCiAgICA8
bWV0YSBuYW1lPSJnZW5lcmF0b3IiIGNvbnRlbnQ9IkhUTUwgVGlkeSBmb3IgV2luZG93cyAo
dmVycyAxc3QgSmFudWFyeSAyMDAyKSwgc2VlIHd3dy53My5vcmciIC8+DQoNCiAgICA8dGl0
bGU+UGV0YWwgU3RyZXNzIFRlc3QgVGVtcGxhdGU8L3RpdGxlPg0KICA8L2hlYWQ+DQogIDwh
LS0/IDw/cGV0YWw6aW5jbHVkZSBmaWxlPSJpbmNsdWRlcy9oZWFkZXIudG1wbCI/PiAtLT4N
Cg0KICA8Ym9keT4NCiAg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