Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I have a perl script and MacOS Classic app (say named './myapp'); I'm on OSX. I need to execute that app from perl script. Running

system('./myapp');
in the proper directory doesn't work ($@ is 'cannot execute binary file'); typing ./myapp in Terminal produces exactly the same error. 'file ./myapp' prints 'myapp: header for PowerPC PEF executable'. I'm not a Mac pro, could anybody give hints what I should do to run it from perl script?

Thanks in advance for your answers!

Replies are listed 'Best First'.
Re: How to run MacOS Classic app in OSX? system() can't run it..
by Fletch (Bishop) on Feb 03, 2006 at 15:39 UTC

    system( "open .../myapp" ) should work. See man open.

    Update: The ... was meant as ellipsis to indicate the full path to the app, not a literal ... in the path.

      Thank you for your answer!

      When I run in while in the same directory where app resides, and run as open ./myapp
      I get

      2006-02-03 08:08:59.110 open[396] LSOpenFromURLSpec() returned -10814 +for application (null) path /Volumes/Untitled 2/myapp 2006-02-03 08:08:59.114 open[396] Couldn't open file: /Volumes/Untitle +d 2/myapp
      When I run
      open .../myapp
      I get
      2006-02-03 08:17:49.352 open[429] No such file: /Volumes/Untitled 2/.. +./myapp
      What the case #1 means - is it a bug in the app I run, or something is wrong with the binary file?

        I'd guess something's wrong with myapp. I just verified that open does start Classic apps (ran the OS 9 versions of SimpleEdit and Graphing Calculator using it fine).

        perl -le 'system( "open", "/Applications (Mac OS 9)/Graphing Calculato +r" )'