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

Re: [MacPerl] MacPerl and [A]CGI startup time



At 02.23 1998.05.08, Eric Hsu wrote:
>Clay Kasow wrote:
>>I wrote a web server (called the MacPerl Web Server) which was supposed to
>>address the issue of slow CGIs on Mac OS.  All CGIs are precompiled as the
>>server is booting up, so they execute super, super fast.

I attempted to use this server, and it bombed my Mac and added 50K to the
size of my MacPerl application.  The app went from 1_655_617 to 1_660_867
bytes.  My menu bar turned from platinum to white.  Then it hung and
crashed.  I grabbed a clean copy of the app and tried again.  Same thing
kept happening.

Anyways, I rewrote my CGI with IO::Socket to do basically a similar thing.

$serv = IO::Socket::INET->new(
    Listen=>2,
    LocalAddr=>'localhost',
    LocalPort=>8000,
    Proto=> 'tcp'
);
die $@ if ! $serv;

$cgi    = CGI->new();

{
    local($\) = $crlf;
    while ($client = $serv->accept()) {
        my $x = <$client>;
        select($client);
        $x =~ s/\s//g;
        $x =~ /submit.x=(\d+)&submit.y=(\d+)/;
        if (!$1 || !$2) {
            do_stuff();
            close($client);
        } else {
            do_other_stuff();
            close($client);
        }
    }
}

Then I just direct hits to http://some.host:9000/.

Certainly not very robust, but this is just for a demo.  :-)  Clay, if you
address the problems above, I'd like to know about it.  Thanks.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch