Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursion Limit

Status
Not open for further replies.

markstangroom

Technical User
Apr 25, 2001
96
GB
I have a perl cgi/dbi script running on a webserver. this script looks up data in a text file and has been happliy working for years now.

I am now setting up a new server with a newer version of Perl. Now that I have transfered over the script etc it will not run if there are too many entries and I get an error message saying recursion limit has been exceeded.If I reduce the size of the text file the problem goes away.

is there something in the new version of perl which is causing this problem.

any help would be greatly appreciated.

thanks

Mark
 
Mark,

It sounds as if your cgi script is doing something funny, and the new version of Perl is picking that up and complaining about it.

Could you modify the script so that it doesn't use recursion? Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
the problem is it's a script i inherited from my predecessor, and to be honest I've never programmed perl/cgi before.

through trial and error i've tracked down where i think the
problem is, but i have no idea how to re-write it.below is part of the script - ive seperated out the part where i think the problem is.



$dbq->execute();
while (@c=$dbq->fetchrow_array) {
&print_entry(@c);
}

$dbq->finish();

# Print the footer and close the file

&print_footer;


thanks

mark



thanks



 
the problem must be somewhere else.

i've pasted in a section of code immediately preceeding the code already posted.

### CGI Input ###

$q = new CGI;

# Set up the query

@keywords = split(/ /,$q->param('KEYWORDS'));
$op = $q->param('OP');

# Output the header

&print_header;

# Get what we're after from the DB

if (@keywords) {
$where = "PutOnWeb = 1 AND (";
foreach $word (@keywords) {
$where .= " Description CLIKE '% ".$word."%' ".$op;
}
$where =~ s/${op}$/)/;
} else {
$where = "PutOnWeb = 1";
}

if ($bedrooms = $q->param('BEDROOMS')) {
$where .= &quot; AND Bedrooms < &quot;.($bedrooms+1).&quot; AND Bedrooms > &quot;.($bedrooms-1);
}

$db = $q->param('DATABASE');

my($dbq) = $dbh->prepare(&quot;SELECT $retr FROM $db WHERE $where&quot;);


thanks

Mark
 
If I'm not mistaken a recursion error occurs when a subroutine calls itself more than 100 times. Do you have anything like that in your script?
 
you're looking for *something* like this

sub Thingy(){
..
..
..
Thingy();
..
..
..
} Mike
&quot;Experience is the comb that Nature gives us after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top