[Petal] Strange parsing of HTML

William McKee william@knowmad.com
Thu, 15 Aug 2002 12:14:14 -0400


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

Is anyone else having HTML comments get parsed oddly in the latest release 
of Petal? What I'm seeing is a comment tag which is embedded in my 
document get placed at the top of the document, effectively commenting out 
most of the page (until an end block is hit). I think this may be an error 
with HTML::Parser.

Attached is a test script with an example of the problem (as well as the 
other problems I've reported). It's weird how a tag in a comment causes 
text to get lost.

Thanks,
William

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


--Message-Boundary-28096
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:  15 Aug 2002, 12:15
     Size:  5512 bytes.
     Type:  Unknown

--Message-Boundary-28096
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
Qy8vRFREIFhIVE1MIDEuMCBUcmFuc2l0aW9uYWwvL0V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BsYXllZDwvcD4NCiAgICA8P3BldGFsOmluY2x1
ZGUgZmlsZT0iaW5jbHVkZXMvZm9vdGVyLnRtcGwiPz4NCg0KICAgIDxociBzaXplPSI1IiB3
aWR0aD0iNzUlIj4NCg0KICAgIDxwPkNyZWF0aW5nIGEgbGluazwvcD4NCiAgICAgICAgPHVs
IHBldGFsOnJlcGVhdD0ic3R1ZGVudCBzdHVkZW50cyI+DQogICAgICAgICAgICA8bGk+PGEg
aHJlZj0iIj48P3BldGFsOnZhciBuYW1lPSJlbmNvZGU6IHN0dWRlbnQuZmlyc3RfbmFtZSI/
PiA8P3BldGFsOnZhciBuYW1lPSJlbmNvZGU6IHN0dWRlbnQubGFzdF9uYW1lIj8+IC0gPD9w
ZXRhbDp2YXIgbmFtZT0iZW5jb2RlOiBzdHVkZW50LmVtYWlsIj8+PC9hPjwvbGk+DQogICAg
ICAgIDwvdWw+DQoNCiAgICA8aHIgc2l6ZT0iNSIgd2lkdGg9Ijc1JSI+DQoNCiAgICA8aDM+
RW5kIFRlc3RzPC9oMz4NCg0KICAgIDw/cGV0YWw6aW5jbHVkZSBmaWxlPSJpbmNsdWRlcy9m
b290ZXIudG1wbCIgdGFpbnQ9IjEiPz4NCg0KICAgIC0tPg0KICA8L2JvZHk+DQo8L2h0bWw+
DQoNCg==

--Message-Boundary-28096
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/;

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',
	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-28096--