Mac: Perl script that will run when double-clicked
Mac: Perl script that will run when double-clicked
am 22.08.2007 19:28:03 von amirkarger
(This may be more a Mac question than a Perl question.)
When I double-click on a Perl script, it opens in TextEdit. Can I tell
Mac to run Perl scripts when they're double-clicked? The "Open With"
menu only lets me pick .apps, and perl isn't one.
It's hard to get good Google results with words like "mac double click
perl". Is there something simple like Windows' file types?
-Amir Karger
Re: Mac: Perl script that will run when double-clicked
am 22.08.2007 20:47:32 von Sherm Pendley
amirkarger@gmail.com writes:
> When I double-click on a Perl script, it opens in TextEdit. Can I tell
> Mac to run Perl scripts when they're double-clicked? The "Open With"
> menu only lets me pick .apps, and perl isn't one.
Open it with Terminal.app.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Re: Mac: Perl script that will run when double-clicked
am 29.08.2007 04:41:53 von amirkarger
On Aug 22, 2:47 pm, Sherm Pendley wrote:
> amirkar...@gmail.com writes:
> > When I double-clickon a Perl script, it opens in TextEdit. Can I tell
> >Macto run Perl scripts when they're double-clicked? The "Open With"
> > menu only lets me pick .apps, and perl isn't one.
>
> Open it with Terminal.app.
>
> sherm--
>
This seems to work only if I have no Terminal.apps open at the moment.
Or am I hallucinating?
-Amir
Re: Mac: Perl script that will run when double-clicked
am 29.08.2007 06:17:58 von amirkarger
On Aug 22, 1:28 pm, amirkar...@gmail.com wrote:
> (This may be more aMacquestion than a Perl question.)
>
> When I double-clickon a Perl script, it opens in TextEdit. Can I tellMacto run Perl scripts when they're double-clicked? The "Open With"
> menu only lets me pick .apps, and perl isn't one.
>
> It's hard to get good Google results with words like "macdoubleclick
> perl". Is there something simple like Windows' file types?
>
> -Amir Karger
Apologies for self-responding. At least a partial answer is, if you
save the program with .command suffix (with #!/usr/bin/perl in the
first line), then when you double click on the file, it'll open a new
terminal window and run.
Problems:
1) You need to chmod +x the script, or it won't run. Which sort of
defeats the purpose of creating a double-clickable program, doesn't
it?
2) Depending on your defaults for Terminal.app, the window might or
might not close when the script finishes.
-Amir
Re: Mac: Perl script that will run when double-clicked
am 29.08.2007 15:58:32 von Anno Siegel
On 2007-08-29 04:41:53 +0200, amirkarger@gmail.com said:
> On Aug 22, 2:47 pm, Sherm Pendley wrote:
>> amirkar...@gmail.com writes:
>>> When I double-clickon a Perl script, it opens in TextEdit. Can I tell
>>> Macto run Perl scripts when they're double-clicked? The "Open With"
>>> menu only lets me pick .apps, and perl isn't one.
>>
>> Open it with Terminal.app.
>>
>> sherm--
>>
>
> This seems to work only if I have no Terminal.apps open at the moment.
> Or am I hallucinating?
Works for me in either situation (Terminal.app already running or not).
Anno
Re: Mac: Perl script that will run when double-clicked
am 29.08.2007 23:54:01 von Anno Siegel
On 2007-08-29 06:17:58 +0200, amirkarger@gmail.com said:
> On Aug 22, 1:28 pm, amirkar...@gmail.com wrote:
> 1) You need to chmod +x the script, or it won't run. Which sort of
> defeats the purpose of creating a double-clickable program, doesn't
> it?
How so? What do you consider the purpose of making a perl script clickable?
Anno
Re: Mac: Perl script that will run when double-clicked
am 30.08.2007 03:57:26 von amirkarger
On Aug 29, 5:54 pm, Anno Siegel
wrote:
> On 2007-08-29 06:17:58 +0200, amirkar...@gmail.com said:
>
> > On Aug 22, 1:28 pm, amirkar...@gmail.com wrote:
> > 1) You need to chmod +x the script, or it won't run. Which sort of
> > defeats the purpose of creating adouble-clickable program, doesn't
> > it?
>
> How so? What do you consider the purpose of making a perl script clickable?
>
> Anno
Good point.
The idea here is that I'm going to have downloadable files that the
user saves to their disk so they can click on it & run without ever
needing to open a Terminal themselves or type stuff on a command
line.
In case you're wondering about the purpose, I have a site called the
Scriptome which provides simple data munging tools for non-programming
biologists. To make things as super-simple as possible (no install or
config necessary), we originally set it up to have Perl one-liners you
cut & paste onto a command line, but people kept telling us that non-
programmers are afraid of the command line. I worked out a way to
make .pl's do the right thing when clicked on Windows, but wasn't sure
how we could handle it on Mac. If I actually knew how to build Mac
apps easily, I could do this in a fancier way (volunteers welcomed!).
But I'm really aiming for this stuff to just work; prettiness, bells &
whistles are optional. (Sorry for the plug, but you asked!)
-Amir
Re: Mac: Perl script that will run when double-clicked
am 30.08.2007 22:37:48 von Ben Morrow
Quoth amirkarger@gmail.com:
> On Aug 29, 5:54 pm, Anno Siegel
> wrote:
> > On 2007-08-29 06:17:58 +0200, amirkar...@gmail.com said:
> >
> > > On Aug 22, 1:28 pm, amirkar...@gmail.com wrote:
> > > 1) You need to chmod +x the script, or it won't run. Which sort of
> > > defeats the purpose of creating adouble-clickable program, doesn't
> > > it?
> >
> > How so? What do you consider the purpose of making a perl script clickable?
> >
> > Anno
>
> Good point.
>
> The idea here is that I'm going to have downloadable files that the
> user saves to their disk so they can click on it & run without ever
> needing to open a Terminal themselves or type stuff on a command
> line.
They don't... it's perfectly possible to chmod a file through the GUI.
In any case, this should be regarded as a security feature of MacOSX: the
point being that a user has to take affirmative action before a random
downloaded file can be executed (yes, I realise there are many ways
around this... still, it's worth something :) ).
Ben
Re: Mac: Perl script that will run when double-clicked
am 03.09.2007 03:46:29 von amirkarger
On Aug 30, 4:37 pm, Ben Morrow wrote:
> Quoth amirkar...@gmail.com:
>
>
>
> > On Aug 29, 5:54 pm, Anno Siegel
> > wrote:
> > > On 2007-08-29 06:17:58 +0200, amirkar...@gmail.com said:
>
> > > > On Aug 22, 1:28 pm, amirkar...@gmail.com wrote:
> > > > 1) You need to chmod +x the script, or it won't run. Which sort of
> > > > defeats the purpose of creating adouble-clickable program, doesn't
> > > > it?
>
> > > How so? What do you consider the purpose of making a perl script clickable?
>
> > > Anno
>
> > Good point.
>
> > The idea here is that I'm going to have downloadable files that the
> > user saves to their disk so they can click on it & run without ever
> > needing to open a Terminal themselves or type stuff on a command
> > line.
>
> They don't... it's perfectly possible to chmod a file through the GUI.
> In any case, this should be regarded as a security feature of MacOSX: the
> point being that a user has to take affirmative action before a random
> downloaded file can be executed (yes, I realise there are many ways
> around this... still, it's worth something :) ).
>
> Ben
I probably should have taken this to a Mac group long ago. But as long
as I'm here ... I know you can chmod g/m/o +/- r/w in the GUI, but is
it truly possible to chmod +x? And if so, how? It's not an option in
the standard or advanced chmod GUI.
-Amir
Re: Mac: Perl script that will run when double-clicked
am 03.09.2007 05:09:20 von Sherm Pendley
amirkarger@gmail.com writes:
> On Aug 30, 4:37 pm, Ben Morrow wrote:
>
>> They don't... it's perfectly possible to chmod a file through the GUI.
>
> I probably should have taken this to a Mac group long ago. But as long
> as I'm here ... I know you can chmod g/m/o +/- r/w in the GUI, but is
> it truly possible to chmod +x? And if so, how?
Ben didn't say you could do it through *Finder's* GUI. :-)
That said, it'd be a simple task to create an Automater workflow to chmod
a bunch of files.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net