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.
Just tell MacPerl to do the script in the droplet rather than launching the droplet. If you launch the droplet it will just go about its business independently.
Suppose at "dx08:Users:jd:temp:macperltemp.pl" I have a droplet with the script
# "dx08:Users:jd:temp:macperltemp.plx" #!perl print "\a"
and I run this AppleScript script:
set _script to alias "dx08:Users:jd:temp:macperltemp.plx" tell app "MacPerl" to Do Script _script
Then MacPerl will run the script, sound a bell and return nothing to the AS script as a result. If you want a result returned to use in the remainder of the AS script, then use mode batch. For example:
# "dx08:Users:jd:temp:macperltemp.plx" #!perl for (1..5) {print $_*12 , "\r"}
set _script to alias "dx08:Users:jd:temp:macperltemp.pl" tell app "MacPerl" to Do Script _script mode Batch -- <<<<<< (* gives... "12 24 36 48 60 " *)