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

Re: [MacPerl] Perl questions




David Herbert (davidh@SDL.UG.EDS.COM) writes:
>(1) I have tried using the BBEdit extension "run perl" with BBEdit Lite
>3.5. It seems to work quite happily, but I have experienced a couple of
>problems with it. I wonder if anyone can tell me how to work round the
>following:
>
>(a) using "run perl" buffers all the output sent to STDOUT by a script, so
>that it all appears in a new BBEdit window at the end. This is a nuisance
>if you're printing progress information as the script executes. Running the
>script from MacPerl itself doesn't do this.
>
>(b) if my script uses a dialog routine such as MacPerl'Answer, the dialog
>window anchors itself at the back of all other windows on the screen.  In
>particular, if it happens to park itself wholly behind another window the
>script is as good as hung, as I can't get the machine to let me access the
>dialog window! My only option seems to be option-cmd-esc at this point. Yes
>I could run the thing on a clear desktop, but running the script from
>MacPerl itself sensibly puts dialog windows to the front.

Currently the only workaround I know of is not to use the BBEdit 
extension. Instead, save the script in BBEdit, switch to MacPerl, select 
Run Script from the Script menu, and select the file containing the 
script. The following AppleScript commands can be used to automate this 
process (there needs to be some error checking added):

tell application "BBEdit 3.5"
    save window 1
    set bbfile to get file of window 1
end tell

tell application "MacPerl"
    activate
    Do Script bbfile
end tell

If this script is compiled with the Script Editor and put into the BBEdit 
Scripts folder it will appear in the AppleScript menu of BBEdit.

I could write an additional BBEdit extension (or add a preference option 
to the current extension) that when run will switch to MacPerl, and send 
the contents of the active BBEdit window to MacPerl to be executed as 
though it were run using the Run Script command (e.g., STDOUT is sent to 
the MacPerl STDOUT window). This would solve problems (a) and (b). Would 
anyone use this? 

Brad Hanson
bhanson@avalon.net