PDA

View Full Version : Enabling/Installing Perl




Aranell
Apr 2, 2006, 05:55 PM
Hi all, I know this question may have a glaringly obvious answer but I was wondering if anyone could tell me the easiest/quickest way of installing/enabling Perl on OSX 10.4? I've had a mad dash around the 'net but to no avail so if anyone could give me a quick hand it would be greatly apreciated!

Thanks



robbieduncan
Apr 2, 2006, 05:59 PM
It's installed and enabled by default which is probably why you can't find any details on it!

Open the Terminal (in Utilities in Applications) and type perl -version

Aranell
Apr 2, 2006, 06:21 PM
Ahh.. must simply be a problem with my code, which probably explains it! :P

Thanks for such a speedy reply!

*EDIT* In this case then, would anybody be able to tell me why my perl scripts simply display the source code when accessed through the browser?

My code is a simple hello world script:


#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "Hello World!";

mrichmon
Apr 2, 2006, 11:53 PM
*EDIT* In this case then, would anybody be able to tell me why my perl scripts simply display the source code when accessed through the browser?

My code is a simple hello world script:


#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "Hello World!";



Because you need to enable cgi scripts in your apache config and place the perl script in the appropriate cgi-bin directory.

robbieduncan
Apr 3, 2006, 02:21 AM
The advice above regarding enabling CGI etc is true if you are trying to access this as a web page (the code looks like that sort of thing) but it should still run from the command line.

If it does not check that the file has execute permissions (try chmod u+x <filename>).

caveman_uk
Apr 3, 2006, 02:47 AM
*EDIT* In this case then, would anybody be able to tell me why my perl scripts simply display the source code when accessed through the browser?

You need to modify the apache config file (httpd.conf) so that it knows what to do with perl files. The same thing happens with php files. By default on Mac OS X client the relevant lines are commented out.

Aranell
Apr 3, 2006, 05:47 AM
Again guys, many many thanks! Just about sorted it now :P

superbovine
Apr 3, 2006, 10:08 PM
Again guys, many many thanks! Just about sorted it now :P

some reading you might enjoy

http://www.onlamp.com/topics/apache/mac_osx