Thought I would run this by the list before submitting on SourceForge...
Chris's AppleEvent tutorial uses this sample for receiving AppleEvents:
sub RecData {
my($event, $reply, $desc, $n) = @_;
$desc = AEGetParamDesc($event, keyDirectObject());
$n = AEPrint($desc);
AEPutParam($reply, keyDirectObject(), typeChar(),
sprintf('%.f + %.f = %.f', $n, $n, $n+$n)
);
print AEPrint($event), "\n";
print AEPrint($reply), "\n";
AEDisposeDesc($desc);
$ok = 1;
0;
Under MacPerl 5.6.1r1 this generates an error when AEDisposeDesc($desc) is
called. Perhaps a double dispose of $desc?
This version clears up the problem, though I'm not sure its correct
(everything I know about AppleEvents I learned from the tutorial :-):
sub RecData {
my($event, $reply, $desc, $n) = @_;
my $directobject = AEGetParamDesc($event, keyDirectObject());
$n = AEPrint($directobject);
AEPutParam($reply, keyDirectObject(), typeChar(),
sprintf('%.f + %.f = %.f', $n, $n, $n+$n)
);
print AEPrint($event), "\n";
print AEPrint($reply), "\n";
AEDisposeDesc($directobject);
$ok = 1;
0;
Or am I totally wrong?
Alex