[Petal] Another rewrite problem in Petal

William McKee william@knowmad.com
Wed, 28 Aug 2002 21:26:40 -0400


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

Jean-Michel,

Another bug to add to the list. This time its a problem with how Petal 
rewrites parameters. It is doing so without regard to case. This is a 
problem for Javascript which is case-sensitive (at least in IE6 on WinNT). 
I've updated and attached the usual test scripts.

BTW, do you have any interest in keeping bug reports via CPAN 
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Petal>? Considering the fact 
that CPAN continues to show only version 0.2 of Petal available despite 
the fact that your directory on CPAN shows all versions, I'd think not. 
Seems like a waste of effort in some respects. I wonder if any modules are 
using the request tracker system?

Cheers!
William

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



--Message-Boundary-31268
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-31268
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:  28 Aug 2002, 21:28
     Size:  6519 bytes.
     Type:  Unknown

--Message-Boundary-31268
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+DQoNCiAgICA8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