--On Tuesday, October 7, 2003 12:12 PM +0200 Louis Pouzin <[EMAIL PROTECTED]> wrote:

Hi,

In an AppleScript script, which calls several apps, there is a call to a
Perl droplet. After running, MacPerl sits there, and eventually an Apple
event times out, breaking the chain.

I have put MacPerl::Quit(1) at the end of the Perl script, to no effect.
MacPerl::Quit(2) unloads MacPerl, but AS doesn't resume.
I don't really want MacPerl kicked out of RAM, only AS to proceed.
And I've never tried dealing with events.

Any suggestion ? Thanks.

You might try downloading MPW and use the Perl MPW tool with ToolServer. You might also be interested in Genie, a POSIX-like command shell environment. Genie includes a command for sending arbitrary Apple events (no AppleScript yet, but it would be pretty easy), and also a wrapper for calling ToolServer, which is invoked automatically when the program is an MPW tool. For example, if you type


Perl -e 'print "Hello\n";'

at the prompt, that gets translated internally to

tlsrvr --escape -- 'Perl' '-e' 'print "Hello\n";'

which results in

'Perl' '-e' 'print "Hello\n";'

being sent to ToolServer in a Do Script event. The output (left as an exercise) :-) is written to a temporary file, which tlsrvr incrementally writes to Genie's stdout (typically a command shell window) -- it doesn't wait for the event to complete to display the output (though in this case it's just the one line, so you wouldn't notice). After the event returns, the ToolServer status (i.e. {Status}) is used as the exit status for tlsrvr.

One of the things I really like about Genie is that it doesn't incur the overhead of AppleScript. Nor does it have the limits of MPW -- a Genie program can call other programs, e.g. by using system(). My software build system (i.e. for my C++ software) is built as a plug-in Genie program, and calls tlsrvr (implicitly, as above) to run the CodeWarrior tools.

If desired, MacPerl itself (i.e. the Perl tool) could be built as a Genie plugin, though this would not be trivial.

I hope you find this helpful, or at least intriguing.

Josh

--
Joshua Juran
Metamage Software Creations - Mac Software and Consulting
http://www.metamage.com/

* Creation at the highest state of the art *




Reply via email to