Launching Perl Scripts

Discussion in 'Mac Programming' started by flyingscott, Mar 12, 2008.

  1. macrumors regular

    flyingscott

    Joined:
    Nov 2, 2007
    Location:
    Michigan
    #1
    I have a number of perl script that I run from the command line, but I really want to run them by simply double clicking the file in the GUI.

    I tried changing the extension to .command, but that didn't work.

    Any suggestions?
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    You can call them from an AppleScript which can then be double-clicked.

    Code:
    do shell script "/path/to/script.pl"
    Then File > Save As, choose "Application bundle" for the File Format, and check Run Only.
     
  3. macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #3
    Make sure the scripts are set as executable (i.e. "chmod +x somefile.pl" makes somefile.pl executable for everyone). That, plus giving them the .command extension works for me...

    Also, you have the appropriate #!/.../perl line as the very first line of the script, right? (sorry, I can't quite remember what that line is supposed to be.)
     

Share This Page