[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Invocation of droplets and apple events



Hi,

I have a problem with MacPerl.  This may be due to my
incompetence as a macintosh programmer.  I'm a former
unix programmer who can't live without perl.

The problem is as follows:

I have an application program "Foo" which I can't modify.
Now and then "Foo" needs to call a program "bar" to process
a text file in the background (but waiting for it to complete).
"Foo" calls "bar" in the following fashion (I've got
this description from the developer of "Foo"):

  "Foo" checks to see if "bar" is running.  If not it calls
  the process manager routine LaunchApplication, and then sends
  an 'odoc' event with a reference to the text file "bar" should process.

"bar" is my perl-script.  If I save it as a runtime,
the script will start with an empty @ARGV, and the text file
is opened in a separate window.
(It works fine if I manually drop the file on the runtime script.)

After some thinking this is to be expected, the LauncApplication
launches the runtime script (which I assume is just MacPerl which
automagially runs the script), MacPerl is then instructed to
open the text file, and so it does, and shows it to me on the
screen as any decent text editor would.  Not exactly what I want,
and my users will no doubt get extremely confused.

I have solved this by letting "Foo" call an AppleScript
which in turn calls "bar" by

  tell app "Finder" to open textfile using file "bar"

However, I'm not very pleased with this solution.
Is there a way to make a perl script respond to an 'odoc' event?

--
Simen Gaure, Department of Mathematics, University of Oslo