More on Mac::AppleEvents, Mac::OSA

| | Comments (0)
I was having problems with AEDescs because I was putting data into Handle using strlen() to get the size. strlen() just figures out the length of a C string, up to the first null. I wanted to use the length from AEGetDescDataSize() or GetPtrSize(). But I didn't.

Mac::OSA::Simple works pretty well, though I need to release a new version to support Mac OS X. I can do stuff like:

use Mac::OSA::Simple;
my $play  = compile_applescript('tell app "iTunes" to play');
my $pause = compile_applescript('tell app "iTunes" to pause');
 
sub play  { $play->execute  }
sub pause { $pause->execute }

Calling play() and pause() are much much faster than calling DoAppleScript($script) over and over again, because the compilation phase of the AppleScript is time-consuming. This kind of thing should work fine now, but return values are broken (the way AEPrint() returns data has changed, and I was using that instead of $desc->get), as is saving a script to disk (e.g., $pause->save($filename); my $script = load_osa_script($filename, 1);; this is related to the problem of my current FSSpec routines requiring files to exist, which needs to be fixed).

So I won't be releasing the new Mac::OSA::Simple too soon; I want to first see about addressing my issues with the FSSpec routines, and I need to revamp how I release modules (bug reporting, CVS, releases on CPAN and SourceForge.net, etc.). use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on December 10, 2002 12:13 PM.

Mac::Carbon 0.02 Released was the previous entry in this site.

Stupid Newlines is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.