Activating PERL

DarkGenius

Registered
Hello

i want to create a web application that runs locally, on my hard disk. i know html, javascript, java, and a bit of c/c++.
since i need to make dynamic web pages, i want to be able to connect a c or java program to my site, i know perl can do that, i even have a cgi file to do it. but I don't know anything about perl. how do i get it to run. my files are in my sites folder, where should i put the cgi file? do i have to activate perl in some way? i know mac os x has it installed. can anybody give me some information.
thanks a lot
jutho
 
Add the following line to your httpd.conf and apache wil run any file with the .cgi extension.

AddHandler cgi-script .cgi

It is not the safest way to do, but I guess you maintain a single user web server, so who cares?

.cgi must not be Perl, it can be nearly any language. So it might look clumsy to use perl ``to connect a c or java program to'' your web site.
 
thanks for the reply.
so i can type the code for my web app, in c for example, and then just rename it to a .cgi file, and that works...
as you see, i have now experience about this stuff at all. but if not in perl (for which we've just got the code in college), how can i reach my querystring, and should i use a main function, (if we're talking about c/c++)?
 
Why not just use PHP? It's as easy to activate and program, and you don't need a separate CGI program. All you need is to embed the script in your pages.
 
Not exactly, Dark Genius. Code for Perl scripts has to be written in the Perl language. It is saved as a plaintext file with execute privileges enabled, and is placed in the /Library/WebServer/CGI-Executables folder (or can be run from any folder if you add the line Eckhart suggested).

The perl script begins with the shebang:
#!/usr/bin/perl

You should be able to run C programs from a Perl script and parse the results, if you want to. Perl doesn't require any setting up to function on Mac, just put the executable scripts into the CGI-Executables folder.
 
Back
Top