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

[MacPerl] Perl Help, Shuck, AppleScript



Like I would guess others on this list I use BBEdit for most of my Perl
editing. About the only feature I miss from the Perl editor is the ability to
Command-click on words to get help. In trying to emulate this behaviour in
BBEdit 4.0 I've come up with the following AppleScript, which I run from
BBEdit's Script menu:

tell application "BBEdit 4.0"
	set foo to text of selection
end tell
set foo to "drive:MacPerl:pod:perlfunc.pod#" & foo
tell application "Shuck"
	activate
	geturl foo
end tell

But I've found that the above script only works when an entry for the
function 'foo' appears as a single word item in the pod file, i.e. it's a
function which can take no parameters. E.g. looking up "time", "split" and
"tell" works but "gmtime", "join" and "telldir" doesn't.

So does anyone know the correct way to get Shuck to look up functions via
AppleScript/AppleEvents ? I hope it's possible as MacPerl manages it somehow.
And would it be possbile to generalise this to look up anything anywhere,
i.e. not just functions in perlfunc.pod ?

BTW, the above script works with BBEdit 4.0.2 but not with BBEdit 4.0.3, as
the latter has problems getting the selection accurately, at least on my Mac.
I've not tried it with other versions. If you don't have BBEdit Pro (the Lite
version isn't scriptable) and want to experiment with scripting Shuck replace
the first three lines of the script with:

set foo to "split"

or similar.

John
--
John Blackburne - programmer, writer, consultant, trainer
Perl, AS, QD3D and more at http://www.hk.super.net/~johnb