Mac: Perl script that will run when double-clicked

Discussion in 'Perl Misc' started by amirkarger@gmail.com, Aug 22, 2007.

  1. Guest

    (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
     
    , Aug 22, 2007
    #1
    1. Advertising

  2. Guest

    On Aug 22, 2:47 pm, Sherm Pendley <> wrote:
    > 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
     
    , Aug 29, 2007
    #2
    1. Advertising

  3. Guest

    On Aug 22, 1:28 pm, 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
     
    , Aug 29, 2007
    #3
  4. Anno Siegel Guest

    On 2007-08-29 04:41:53 +0200, said:

    > On Aug 22, 2:47 pm, Sherm Pendley <> wrote:
    >> 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
     
    Anno Siegel, Aug 29, 2007
    #4
  5. Anno Siegel Guest

    On 2007-08-29 06:17:58 +0200, said:

    > On Aug 22, 1:28 pm, 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
     
    Anno Siegel, Aug 29, 2007
    #5
  6. Guest

    On Aug 29, 5:54 pm, Anno Siegel <-berlin.de>
    wrote:
    > On 2007-08-29 06:17:58 +0200, said:
    >
    > > On Aug 22, 1:28 pm, 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
     
    , Aug 30, 2007
    #6
  7. Ben Morrow Guest

    Quoth :
    > On Aug 29, 5:54 pm, Anno Siegel <-berlin.de>
    > wrote:
    > > On 2007-08-29 06:17:58 +0200, said:
    > >
    > > > On Aug 22, 1:28 pm, 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
     
    Ben Morrow, Aug 30, 2007
    #7
  8. Guest

    On Aug 30, 4:37 pm, Ben Morrow <> wrote:
    > Quoth :
    >
    >
    >
    > > On Aug 29, 5:54 pm, Anno Siegel <-berlin.de>
    > > wrote:
    > > > On 2007-08-29 06:17:58 +0200, said:

    >
    > > > > On Aug 22, 1:28 pm, 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
     
    , Sep 3, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,868
  2. Sydex
    Replies:
    12
    Views:
    6,653
    Victor Bazarov
    Feb 17, 2005
  3. spinybabler
    Replies:
    4
    Views:
    763
  4. Replies:
    6
    Views:
    168
    Tad McClellan
    Apr 14, 2005
  5. spinybabler

    onclick gets fired even when double clicked

    spinybabler, Aug 7, 2009, in forum: Javascript
    Replies:
    1
    Views:
    104
    Thomas 'PointedEars' Lahn
    Aug 7, 2009
Loading...

Share This Page