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

[MacPerl-Toolbox] Idling



I think MacPerl needs a better idle function for when sending with
kAEWaitReply.  MacPerl just hangs and doesn't really respond to anything.
I don't know how to fix it, but I think it should be fixed.  :)

That said, I have found a workaround of sorts.  This sets up a handler to
catch all replies sent to MacPerl, and then send with kAEQueueReply.  Then
we wait with WaitNextEvent, and we can do what we want while waiting for
the reply.

#!perl -wl
use Mac::AppleEvents::Simple qw(:all);
use Mac::Events;

$Mac::AppleEvents::Simple::SWITCH = 0;
$AppleEvent{"aevt", "ansr"} = \&foo;

$x = build_event(qw(syso ppcb R*ch));
$x->send_event(kAEQueueReply);

WaitNextEvent until $brooklyn;

sub foo {
  my($evt, $rep) = @_;
  print AEPrint $evt;
  print AEPrint $rep;
  $brooklyn = 1;
  0;
}

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org