Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Aranell

macrumors newbie
Original poster
Jul 27, 2005
6
0
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

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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

macrumors newbie
Original poster
Jul 27, 2005
6
0
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:

Code:
#!/usr/bin/perl

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

mrichmon

macrumors 6502a
Jun 17, 2003
873
3
Aranell said:
*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:

Code:
#!/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

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
Aranell said:
*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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.