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

[MacPerl] RFC: Suitability of MacPerl as a CGI language



Howdy!

I am an enthusiastic user of MacPerl and consider it an essential tool
on my Macintosh.  Most any standalone program that does text processing
or calculation that runs on a Mac I have and will write in MacPerl.
Now, with the addition of the toolbox routines (and my belated
understanding and appreciation of them) I will be using MacPerl for
construction of tools where front end is an issue as well.  So, at this
point I would like to say:

THANKS!

...to Matthias and the entire MacPerl community for this wonderful tool.
I would have felt this way had I paid hundreds of dollars for it, and
at its price I am stunned.

Having said that, I would like to open a somewhat general discussion of
one area for which MacPerl is recommended, where I think it is
inappropriate: the construction fo CGI's on a Mac web server.  My
opinion is based on having completed a couple of projects in which I so
used MacPerl.  I would not do another such project in MacPerl, and I
plan to convert the existing projects to Frontier or AppleScript as
opportunity arises.  This is despite the fact that MacPerl is a
fantastic tool for this purpose in almost every way.  Unfortunately, it
has one flaw that, to my mind, makes it unsuitable: the fact that you
cannot accept a request for a second MacPerl CGI while a first one is
running.

One comment that has been made on this list is that one should save
MacPerl CGIs as .cgi rather than as .acgi is this makes them more
stable.  I have found that as well.  When a .cgi is running and a second
request for the same or a different MacPerl .cgi is made, the second
request is just ignored and the user gets a "timed out" error.  In the
case of an .acgi, I have had much worse and less predictable behaviors,
including system crashes.  Unfortunately, only by using an .acgi can one
do server push, an essential feature for me as I am frequently returning
large amounts of data from a database that takes a long time to
generate, and the server will time out and/or the user will give up
unless I can give them data a little at a time.  My comments are: 1) if
.acgi's are not recommended, this should be documented (the purpose of
this thread?), 2) the behavior of .cgi's is still unacceptable for the
kind of work I do.

I understand the explanation for MacPerl's behavior: it is due to the
lack of threading in Perl and therefor in MacPerl.  I understand that
there is a desire to add threading to MacPerl, and then when this is
added, my objection will evaporate.  (I have written many CGIs in Perl
on Unix systems and will continue to do so, and I understand that the
reason this works better than MacPerl/MacOS is differences in the way
the OS's work.)  What I am interested in is some combination of the
following:

1) An explanation of how I have been stupid; how all these problems are
solvable so that I can recant and continue using MacPerl for
Mac.(a)cgi's.  This is my preferred outcome :-)

2) A consensus that I am correct, that although MacPerl cgi's work as
advertised and are wonderful for experimentation or certain lightweight
applications, they should be avoided for more serious projects until
threading comes to MacPerl.  At least then I would feel secure in using
an otherwise inferior solution.

3) A discussion of what, at least in theory, could be done to solve this
problem in the short term.  I have a couple of ideas along this line:

    i) Add threading to the cgi glue rather than to MacPerl itself.  The
    glue (AFAIK) already notes if MacPerl is running and does different
    things depending on that.  If all (a)cgi's were set to have Perl
    exit upon completion, then what the (threaded) glue would do is wait
    until Perl is NOT running before invoking it with its script.
    (Actually,  much of what I need would be accomplished WITHOUT
    threading.  My biggest problem is foo.cgi blocking bar.cgi, not two
    rapid hits to foo.cgi, but my feeling is that threading is needed to
    make this solution clean enough to be worth implementing.)  Is this,
    in theory, feasible?  Is there a better way to accomplish this?

    ii) Development of an alternative to using the cgi glue.  I am
    thinking of an AppleScript that accepts all cgi requests and does
    the above.  I have played around with this a little bit, and it
    seems like it could work.  It would by necessity be more manual and
    uglier in setting up a cgi, but I think it could be made transparent
    to the user.

What do y'all think?

-David-

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 mac-perl-request@iis.ee.ethz.ch