Re: [MacPerl-WebCGI] Dumb newby question
[email protected] (David Steffen) Sat, 19 Apr 2003 10:53:18 -0500
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <[email protected]> |
>> At 19:09 +1000 04/19/2003, Wayne Irvine wrote: >> >> I've got a WebStar 4.5 server (G4 OS 9.1) and today I installed >> MacPerl >> (using an installer. Not making or compiling). >> >> I installed MacPerl to run SimpleForum. I've since opened SimpleForum >> in >> MacPerl and saved it as a self executable MacPerl file. When I >> trigger the >> CGI from a web browser I just get 'Error executing CGI application.' >> >> http://www.byteserve.com.au/simpleforum/simpleforum.cgi >> >> Can anyone tell me what I'm doing wrong? > On Saturday, April 19, 2003, at 10:15 AM, Bill Becker wrote: > > I believe, although I've not done it personally, that there is an > option in the "save-as" dialog to save a script as a CGI? > > You also have to make certain it's in the correct folder. I believe you are correct. It has been a long time since I have been a regular participant in this list and even longer since I have had an actively involvement with MacPerl CGIs (though I am still running a very old WebSTAR/OS8/MacPerl5.004 server) but I think the following is still probably accurate: http://www.perlmonth.com/perlmonth/issue11/mac_perl.html A small excerpt from that article: ---=== Begin Excerpt ===--- Mechanics of Running MacPerl CGI scripts A CGI script for MacPerl is usually identical to a *nix CGI script; most *nix CGI scripts will run without modification under MacPerl and the ever popular CGI.pm module is just as useful on the Mac as it is on *nix. To run a Perl script as a CGI on a Mac, you will need to have both MacPerl and a Web server installed on your Mac, and have TCP/IP properly set up, all of which are beyond the scope of this article. I have personally used the MacHTTP/WebSTAR, Quid Pro Quo, and Personal Web Sharing web servers and they all work fine. I suspect that most Mac HTTP servers will work as well. There are some differences in interaction between different web servers and MacPerl, as well as different versions of Mac OS, so your experience may vary a little from what's written here. I will try to point out places where I suspect such variability to lurk, but be aware that my current experience is with Quid Pro Quo running under Mac OS 8.1. Since Quid Pro Quo is free, currently being supported, available via the web [2], and seems to garner mostly favorable reviews, you might want to give it serious consideration. The MacPerl interpreter comes in two forms; one which can be run with MPW and/or toolserver and one which is a stand-alone application. The stand-alone application is typically used for writing MacPerl CGI scripts and will be the form of MacPerl discussed here. If MacPerl is installed properly on your Mac, you will have four options when you save a Perl script from the MacPerl application: 1. Plain text 2. CGI Script 3. Droplet 4. Runtime version You must save your script as CGI script to run it as a CGI on a Mac. This is a major difference between MacPerl and *nix Perl, and is perhaps the most common difficulty people have when they first start trying to use MacPerl for CGI scripts. On the other hand, if you are prototyping a CGI script on a Mac which is eventually going to run on a *nix server, you must save a copy as Plain Text before transferring it to the *nix system; the CGI Script form will be useless to a *nix-based perl. Your Web server may have to be configured to use CGI scripts, may have a particular location on the disk where it wants the CGI scripts, and may have conventions as to how it wants the CGI scripts named. Using a default installation of the latest version of Quid Pro Quo (2.1), you select a Folder on your Macintosh to contain the entire website and create a folder therein named "cgi-bin" in which all CGI programs and scripts must reside. They must also be named with a .cgi extension (foobar.cgi, perlscript.cgi, etc.) or a .acgi extension. For now, you should name all your MacPerl CGIs with the .cgi extension; the difference between .cgi and .acgi will be discussed in a later column. Given the above assumptions, you create your Perl script using any text editor or the MacPerl application, or you can download a CGI script from your *nix server. You then open it with the MacPerl application and save it as a CGI Script into the cgi-bin folder of the root folder of your Web server. You should now be able to access it with the URL: http://example.org/cgi-bin/your-script-name.cgi You do not need to have either your CGI Script or MacPerl running; the Web server will start them automatically. ---=== End Excerpt ===--- -David Steffen-