PDA

View Full Version : Launching Perl Scripts




flyingscott
Mar 12, 2008, 07:59 PM
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?



kainjow
Mar 13, 2008, 12:32 AM
You can call them from an AppleScript which can then be double-clicked.

do shell script "/path/to/script.pl"

Then File > Save As, choose "Application bundle" for the File Format, and check Run Only.

iSee
Mar 13, 2008, 09:16 AM
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.)