[Petal] Petal and mod_perl, redux

William McKee william@knowmad.com
Mon, 5 Aug 2002 07:40:25 -0400


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

I've finally figured out some of my problems with using Petal under 
mod_perl. Part of the problem is that I've not used mod_perl before and 
part stems for Petal.

The part that was user error had to do with my httpd.conf file. I was 
incorrectly setting PerlSendHeader On in that file. My scripts are using 
CGI::Application and running under Apache:Registry. I think that sending 
the headers from CGI::Application was causing problems in Registry. Simply 
setting that to off fixed my display problems. 

The setting that was generating the extended error messages was PerlWarn 
On. Once I figured out where the actual error message was in the stack 
trace that PerlWarn was generating, I was able to track the problem down 
to the CodeGenerator. When this module creates the perl code based on the 
template directives, in some circumstances it can declare my @array 
multiple times. With use strict turned on, this will generate a warning. 

Attached is a diff which fixes this problem (you can remove the comments). 
The diff also includes the removal of a spurious semicolon at the end of 
one of the subroutine blocks. Yes, I saw that you had uploaded 0.5 and the 
diff is based off that release.

Cheers,
William

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



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

47a48,49
>     # WLM's changes - predefine @array var
>     push @code, "    " x $indent . "my \@array;";
159c161
< };
---
> }
184c186,187
<     push @code, ("    " x $indent . "my \@array = \@{\$hash->{'$variable'}};");
---
>     #push @code, ("    " x $indent . "my \@array = \@{\$hash->{'$variable'}};");
>     push @code, ("    " x $indent . "\@array = \@{\$hash->{'$variable'}};");

--Message-Boundary-9832--