CGI Failures --lineoffset

Sivakatirswami katir at hindu.org
Thu Dec 30 00:13:02 EST 2004


I'm getting failures of certain functions when running script(s) as a 
cgi either on under apache/Darwin engine or Linux/Linux Engine, that 
work perfectly fine from within the IDE under OSX with 2.5.  (engine 
version I'm running on darwin is returning MC 2.5  while under my IDE 
in OSX I'm getting 2.6.1)

Here is the latest anomaly : the lineoffset

I have a function which is intended to do the same job as mod_include 
on cgi output where template files have SSI's that I want to parse for 
insertion of SSI chunks. This way when these chunks are changed all the 
templates used in CGI output also change, automatically (an old 
problem: Apache doesn't do this, yet.. cross your fingers...)

Basically the script is trying to target includes like this:

<div id="siteWideNavTop">
				<!--#include virtual="/ssi/site_wide_nav.html" -->
</div>

using the following function to get the include, and return the 
template file with the include inserted.  After mysterious failures I 
focused in on the lineoffset function and returned that variable 
itself... running under OSX from inside the IDE I am getting line 22 
returned by

   put lineoffset (tSSI,tTemplate) into tIncludeLine

but running as a CGI using the Darwin engine...  I'm getting

line 1

I tried this:

set the linedelimiter to numtoChar(10)

thinking we are having some underlying OS line delimiter confusion, but 
it didn't help...

anyone know anything about this?  I've a few other "only in CGI mode" 
bugs that are very pesky....The version of the engine running revApp 
2.5  is 2.6.1... but the version I get back from the Darwin engine is 
metacard 2.5... but the lineoffset function is "ancient history" I 
wouldn't think that this difference in engine version would make a 
difference.

Lineoffset is a "mission critical' function for lots of html 
manipulation processes.. any insights?

===========

function insertInclude tTemplate,tSSI

# this did not help:
--set the linedelimiter to numtoChar(10)


   put lineoffset (tSSI,tTemplate) into tIncludeLine

# ignore the rest of this until the last line
# all this works fine on OSX running under the IDE

   # the actual include is one line down
  # put tIncludeLine+ 1 into tIncludeLine

   # pull out the path to the chunk
   # which is the only quoted string in the include

   set the itemdel to quote
   put item 2 of (line tIncludeLine of tTemplate) into tPath
   delete char 1 of tPath

   ## we have to climb out of the cgi-bin
   # on Varuna, (production server) for testing:

   put ".." before tPath

# on Siddhi  (distribution server, final cgi to check in)
  -- put "../html/" before tPath

   # *always* put the expression pointing to a URL in parenthesis
   # otherwise it will fail, unlike most  other xTalk expressions
   # where the cat operator "&" is usually first in precedence
# in this case (url "file:") is first in evaluation... then the concat 
"&"

   put url ("file:" & tPath) into tIncludeChunk

   put line tIncludeLine of tTemplate into tSSI

   replace tSSI with tIncludeChunk in tTemplate
#return tTemplate
   return tIncludeLine
## I get "22" under with 2.5 running under the IDE, but
## we get "1" running as a CGI with the Darwin engine
end insertInclude



Sannyasin Sivakatirswami
Himalayan Academy Publications
at Kauai's Hindu Monastery
katir at hindu.org

www.HimalayanAcademy.com,
www.HinduismToday.com
www.Gurudeva.org
www.Hindu.org



More information about the use-livecode mailing list