[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Error type 12 with .acgi



>According to [David Steffen's] note, he has real trouble getting 
>.acgi to run with MacPerl. He says that MacPerl isn't handling the 
>threading right. That's
>odd, because the NetPresenz documentation suggests using asynchronous CGI
>over synchronous.

Does it specifically suggest this with MacPerl?  Most Mac Web servers 
assume you will be writing CGI's with AppleScript.

I am not an expert on threads, threads on a Mac, or the AppleEvents 
IPC by which a Mac Web server communicates with a CGI, but here is my 
impression as to what is going on, based on a fair bit of experience 
and some focussed experimentation:

Naming a file .acgi instead of .cgi is a signal which can have two 
different consequences.  The "standard" one is to signal to the web 
server that the cgi can handle multiple threads.  A second one, which 
I don't know if or how it is related to the first and which I have 
only seen used with MacPerl, is to signal "server push'; that is, 
that the output of the cgi should be returned to the client a bit at 
a time rather than all at once.

Consider the "standard" use first: supposing you have one or more 
Frontier .acgi's and you have a second hit on one of these before the 
first is finished processing.  Frontier will interleave processing of 
the two hits such that they finish processing and return output at 
close to the same time.  Applescript will finish processing the first 
hit, return output, and then begin work on the second hit.  MacPerl 
will drop the second hit or crash.  What Frontier does is ideal, and 
if I was determined to do a serious website on a Mac, I'd probably 
pay the money for Frontier.  In my previous post I described what 
AppleScript does as a "NOOP"; that is sort of true, but what it does 
do is allow the web server (e.g. NetPresenz) to pass on the request; 
AppleScript takes responsibility for the queuing.  (You can see why 
NetPresenz would suggest using an .acgi.)  Thus, with AppleScript you 
can choose .cgi or .acgi depending on whether you would prefer 
AppleScript or the server to handle the queuing; this decision will 
presumably be different for different webserver software, and 
probably could only be made intelligently with some experimentation.

MacPerl cannot handle queuing, much less parallel execution.  Thus, 
you must never use a MacPerl .acgi on any site where there is a 
possibility of overlapping hits.  The only reason you would want to 
use an .acgi with MacPerl is to take advantage of server push.  This 
is fine for experimentation, but it would be the rare production 
website that should use .acgi with a MacPerl CGI.

-David Steffen-
David Steffen, Ph.D.
President, Biomedical Computing, Inc. <http://www.biomedcomp.com/>
Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org