[Petal] Re: [MKDoc-modules] Error using MKDoc::XML with Petal - splitpath

William McKee william at knowmad.com
Sat Oct 4 21:01:56 BST 2003


On Sat, Oct 04, 2003 at 10:45:38AM +0100, Jean-Michel Hiver wrote:
> It seems to me as two different bugs. It would be great if you could
> reproduce this in two test cases, so that I can test them in both Perl
> 5.8, Perl 5.6, and get them both to work.

Ok. Something very weird is happening here. I could get the splitpath
error to appear using Petal::Parser::HTB if I called the same Apache
child twice or more (the first time produced the can't use string as
subroutine ref).

So I wrote a command line test. It worked with no errors using either
MKDoc::XML or Petal::Parser::HTB! Time for the debugger.  With the
debugger, instead of getting an error, I got a segmentation fault!
Eventually tracked that down to the use of Taintmode.

It turns out that when run with $Petal::TAINT under Apache::Registry,
the reval function from the Safe module is returning undef. Running from
the command-line, it returns a subroutine reference. Now the $60K
question is why?

I've attached my test script and template. Use it as follows:
	`perl -Tw petaltest.pl category.tmpl`

Of course the simple solution is to turn off the taintchecks. This
course of action seems more and more common these days amongst the
various Perl modules and applications that I use. For better or worse, I
was trained to always use taintmode and use strict. Nobody has yet
convinced me that it's worth undoing taintmode despite the extra efforts
involved in getting my code to work using it. Any takers? I'm about as
close to chucking taintmode support as I've ever been <g>.

Since this appears to be more of a Petal issue now rather than an
MKDoc::XML issue, I have cross-posted this reply to both lists. I
suggest that we keep any ensuing conversation on the Petal list.

Cheers!
William

-- 
Knowmad Services Inc.
http://www.knowmad.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: petaltest.pl
Type: application/x-perl
Size: 1252 bytes
Desc: not available
Url : http://lists.webarch.co.uk/pipermail/petal/attachments/20031004/17b7fb4b/petaltest.bin
-------------- next part --------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Created on Jul 2, 2003 10:14:49 AM -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:petal="http://purl.org/petal/1.0/" xml:lang="en" lang="en">
	<head>
		<title>Category of Needs- <?var name="title" ?></title>
		<link rel="stylesheet" type="text/css" href="ccnew.css" />
		<style type="text/css">
			/*<![CDATA[*/
			#fact_field { position: absolute; top: 2.75in; left: 1.66in; width: 1.5in; visibility: hidden;
				font-size:18px; font-weight:bold;text-align:center; }

			/*]]>*/
		</style>

		<script language="JavaScript" type="text/javascript">
			//<![CDATA[

			function show(fact) {
				//alert("text = " + document.getElementById('fact_field').innerHTML);
				document.getElementById('fact_field').innerHTML = needsfacts[fact];
				// alert(needsfacts[fact]);
				if (document.getElementById) { // DOM3 = IE5, NS6
					document.getElementById('fact_field').style.visibility = 'visible';
				}
				else {
					if (document.layers) { // Netscape 4
						document.visibility = 'visible';
					}
					else { // IE 4
						document.all.style.visibility = 'visible';
					}
				} 
			}

			function hide() {
				if (document.getElementById) { // DOM3 = IE5, NS6
					document.getElementById('fact_field').style.visibility = 'hidden';
				}
				else {
					if (document.layers) { // Netscape 4
						document.fact_field.visibility = 'hidden';
					}
					else { // IE 4
						document.all.fact_field.style.visibility = 'hidden';
					}
				}
			}


			var needsfacts = new Array()
			needsfacts["Advoc"] = "Advocating for our Common Good"
			needsfacts["DMV"] = "Domestic Violence"
			needsfacts["Econ"] = "Economics of Poverty"
			needsfacts["Envir"] = "Environment"
			needsfacts["Educ"] = "Education Concerns"
			needsfacts["Health"] = "Healthcare in Mecklenburg County"
			needsfacts["Homeless"] = "Homelessness in Mecklenburg County"
			needsfacts["Housing"] = "Housing"
			needsfacts["Hunger"] = "The Hungry in Mecklenburg County"
			needsfacts["Immig"] = "Immigrants to Mecklenburg County"
			needsfacts["Just"] = "The Justice System in our county"
			needsfacts["Social"] = "Social Capital"
			needsfacts["Race"] = "Race Relations"
			needsfacts["Relg"] ="Religious Diversity"



			//]]>
		</script>
	</head>
	<body>
		<div id="navigation"><a href="index.html">Meck Min Home</a> <a
				href="needs.html">Congregational College Home</a> <a href=
				"needs.html">Community Needs</a> <a href="needs.html">Complete
				Program Catalog</a> <a href="needs.html">Upcoming Programs</a> <a
				href="needs.html">Program Registration</a> <a href=
				"needs.html">Contact Us</a> 

			<p>Invest in Mecklenburg Ministries</p>

			<a href=
				"http://www.guidestar.org/partners/networkforgood/donate.jsp?ein=56-1583407">
				<img alt="" src="image/donatenowlogo1.gif" width="130" height=
				"43" /></a> 

			<p><span class="fit">Mecklenburg Ministries<br />
				1510 E. 7th St.<br />
				Charlotte, NC 28204<br />
				704-347-2404 (phone)<br />
				704-347-1766 (fax)<br />
			</span></p>

			<p>&nbsp;</p>

			<p>Rev. Andy Baxter, <em>Executive Director</em></p>

			<p>Susan Hill, <em>Assistant to the Director</em></p>
		</div>

		<div id="bgnav"><img alt="" src="image/cc01.gif" /></div>

		<div id="content"><img alt="" src="image/ccint.gif" /> <img alt=""
			src="image/cctempmast.gif" /> <img alt="" src=
			"image/newlogocatagory.jpg" border="0" usemap="#needs" /> 

			<p id="fact_field">test</p>

			<map id="needs" name="needs"><!-- #$-:Image Map file created by Map THIS! -->
				<!-- #-:Map THIS! free image map editor by Todd C. Wilson -->
				<!-- #-:Please do not edit lines starting with "#" -->
				<!-- #VERSION:1.30 -->
				<!-- #DATE:Tue Aug 26 10:43:18 2003 -->
				<!-- #PATH:C:\Documents and Settings\Office\My Documents\testcc\image\ -->
				<!-- #GIF:newlogocatagory.jpg -->
				<area shape="rect" coords="311,64,447,99" href="homelessness.html"
				onmouseover="show('Homeless')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="349,114,432,151" href="Housing.html"
				onmouseover="show('Housing')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="363,167,449,201" href="Poverty.html"
				onmouseover="show('Econ')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="363,221,460,254" href="Educ.html"
				onmouseover="show('Educ')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="341,259,458,288" href="Health.html"
				onmouseover="show('Health')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="323,293,450,318" href="Environment.html"
				onmouseover="show('Envir')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="172,328,360,390" href="Advoc.html"
				onmouseover="show('Advoc')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="24,310,181,336" href="Social.html"
				onmouseover="show('Social')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="4,270,163,300" href="Race.html"
				onmouseover="show('Race')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="7,195,118,255" href="Religious.html"
				onmouseover="show('Relg')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="34,138,122,170" href="Hunger.html"
				onmouseover="show('Hunger')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="37,97,176,130" href="Immigrants.html"
				onmouseover="show('Immig')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="26,59,165,88" href="justice.html"
				onmouseover="show('Just')" onmouseout="hide()" alt="" />
				<area shape="rect" coords="171,29,345,61" href="domesticv.html"
				onmouseover="show('DMV')" onmouseout="hide()" alt="" />
				<area shape="default" alt="" />
		</map></div>
	</body>
</html>



More information about the Petal mailing list