perl & AS [was: set va..]
perl & AS [was: set va..]
- Subject: perl & AS [was: set va..]
- From: John Delacour <email@hidden>
- Date: Sat, 19 Oct 2002 22:17:35 +0100
- Mac-eudora-version: 5.3a5
At 8:54 am +0200 19/10/02, Terje Bless wrote:
>Now for the good news -- you can use perl in AppleScript... [...]
Oddly enough -- since I've actually done the opposite -- constructing a
Perl script on the fly from AppleScript hadn't occurred to me. Thanks!
The trouble with doing the opposite, and it's a big disadvantage, is
that it's terribly slow since the AppleScript needs to be compiled
every time you run the perl. I played a bit with the various glues
that pudge and others produced and found them all impossibly slow,
besides being complicated. At the time I was using a 180 MHz machine
with MacPerl and that's the test. Whether in OS 7+ with MacPerl or
on a "fast" machine with OS 10, it is far easier and many times
faster to send AE _to_ MacPerl or the shell because there is no
compile time.
Are there any other nifty keen tricks for combining AppleScript and Perl I
should be aware of? Would, say, the combination of AppleScript Studio and
CamelBones allow me to mix and match Perl and AS inside Project Builder?
I haven't got anyone to download Camelbones for me yet -- it's huge,
isn't it? -- but the only trick is sending a single AE to the perl
engine, whether from Applescript of Frontier.
Hmmm, or do any AppleScript data types stringify into a structure I could
parse into an equivalent datastructure on the Perl side? The string
representation of a AS Record looks promising. Perhaps a Perl module that
automagically creates (Perl) datastructures and/or objects from stringified
AS structures passed in ARGV?
John Baxter some while ago wrote a routine to change AppleScript's
long date format to something usable by Frontier. I imagine
something similar could be done for perl bit I haven't got round to
doing it yet.
on ldtToDate (ldt) {
local {
high = number(binary(string.mid(ldt, 1, 4)));
low = number(binary(string.mid(ldt, 5, 8)))};
return date(low)}
JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.