At 01:45 PM 8/15/99 -0400, Chris Nandor wrote: >At 12.40 -0700 1999.08.13, Tom Sackett wrote: >>For most housekeeping tasks, this works great. However, I also need, >>sometimes, to update the client script itself, which means that client >>script has to terminate and be re-launched. This was easy to implement in >>Windows using "exec," but I can't find a way to do it in MacPerl. > >There is no clean way to do it. Search on the list archives for >"launchotherperl.plx". It is a kludge to make a copy of the MacPerl app, >and then launch it with another script. Under Mac OS, each app can only be >running once, so you need copies. That script might do what you need, even >if it takes a bit of modification. After a weekend away from my computer, and a few hours more experimentation, I think I've found a relatively clean way of making a script exit and launch another script (in the manner of "exec"). You can just call this subroutine from within a script, providing it with one parameter, a path to the script you want to launch. This is pretty basic, and lacks even simple error handling; anyone using it might want to beef it up a bit. #---------------------------------------------- # LaunchOther # This Mac subroutine exits the current script # completely and launches another script. # It requires the module Mac::AppleEvents. # It takes one parameter, a path to the script # to be launched. #---------------------------------------------- sub LaunchOther { #set up AppleScript my ($scriptPath) = @_; my ($ASstring) = qq{ try with timeout of 0 seconds tell application "MacPerl" Do Script "$scriptPath" end tell end timeout on error end try }; MacPerl::DoAppleScript ($ASstring); exit; } - Tom Sackett tsackett@adobe.com ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org