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

Re: [MacPerl] Help with MacPerl cgi-scripts?



Richard Rathe wrote:
 
> I second the motion! The "MacPerl.Frontend" file included with MacPerl is a
> bit of a tease. I couldn't really follow what's going on. A simple form
> example is definitely needed. Help!

Many others have MUCH more experience than me, but here is just to share 
my experience, as few weeks ago I had the same problem.

For a start, just try this:

------------------------------ cut ------------------------
require "cgi-lib.pl";   # to download from your perl ftp server...
print &PrintHeader;     # shall start any HTML document.
print "This is my first test!\n";
------------------------------ cut ------------------------

Save as cgi and call it through your Web browser.

Then, if you don't already know the HTTP tags, it's time to learn them; 
otherwise you know (almost) all you need to know to go on. (look for 
parameters in $ENV).

Tip:

To test your script without each time saving it as cgi then launch your 
web browser, use this:

if ($#ARGV > -1) {      # argument: use the first one as query (useful 
for debug!)
        $query = $ARGV[0];
}
else {
        $query = $ENV{"QUERY_STRING"};
} 


Also, look at cgi-lib.pl: it contains useful procedures.

Good luck!

G. Gendreau