Enabling/Installing Perl

Discussion in 'Mac Programming' started by Aranell, Apr 2, 2006.

  1. Aranell
    Expand Collapse
    macrumors newbie

    Joined:
    Jul 27, 2005
    #1
    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
     
  2. robbieduncan
    Expand Collapse
    Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    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
     
  3. Aranell
    Expand Collapse
    thread starter macrumors newbie

    Joined:
    Jul 27, 2005
    #3
    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!";
    
    
     
  4. mrichmon
    Expand Collapse
    macrumors 6502a

    Joined:
    Jun 17, 2003
    #4
    Because you need to enable cgi scripts in your apache config and place the perl script in the appropriate cgi-bin directory.
     
  5. robbieduncan
    Expand Collapse
    Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    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>).
     
  6. caveman_uk
    Expand Collapse
    Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #6
    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.
     
  7. Aranell
    Expand Collapse
    thread starter macrumors newbie

    Joined:
    Jul 27, 2005
    #7
    Again guys, many many thanks! Just about sorted it now :p
     
  8. superbovine
    Expand Collapse
    macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #8

Share This Page