Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

LSL + mySQL results in loop

Geo Vandeverre
Registered User
Join date: 30 Nov 2006
Posts: 18
02-26-2007 18:18
hello all, I am trying to write a script that will reference a mysql database. equesting data is fine but when I try to mod data in the db....using a perl script on the server...I end up looping nad making loads of requests. script is below, any help would be appreciated.


string requestStatus;
string action="mod";
default
{

state_entry()
{
llListen(3,"","","";);
}

listen( integer chan, string name, key id, string msg )
{

llSay (0, action);
if (msg == action)
{

string urlForStoringStatus = "http://www.URL.com/perlscript.cgi?lotnum="+ llGetObjectName();

requestStatus = llHTTPRequest(urlForStoringStatus,[HTTP_METHOD,"GET"],"";);

}
}

http_response(key request, integer status, list metadata, string body)
{


list entries = llParseString2List(body, [","], []);
llSay (0, llList2String(entries,1));

// next request calls the perl script which updates the database, this is where the looping happens
string dbUpdate = llHTTPRequest("http://www.URL.com/perlscript.cgi?&mod=yes&nstatus=notrented&lotnum="+ llGetObjectName(),[HTTP_METHOD,"GET"],"";);



llSay (0, requestStatus);
}
}
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
02-26-2007 19:07
http_response() is going to be called again by the second llHTTPRequest, becasue the web server will return headers, even if the PERL script does not send anything back. You'll probably want to have it switch states for the second HTTP Request.
_____________________
Geo Vandeverre
Registered User
Join date: 30 Nov 2006
Posts: 18
02-26-2007 19:45
From: Jillian Callahan
http_response() is going to be called again by the second llHTTPRequest, becasue the web server will return headers, even if the PERL script does not send anything back. You'll probably want to have it switch states for the second HTTP Request.



thanks, how do I do that?
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
02-27-2007 04:13
See here
_____________________