Hi Kevin, > Related to my other question about Perl, Mac IPC and Tkx, I > have a more basic question about Tcl/Perl integration. > > Tcl has a module for integrating Apple Events and Tcl > called TclAE. I previously tried to integrate this with my > apps, and thought it worked, but once I started doing more > complex things, I got stuck. I suspect the reason is that > required parameters/args at the Tcl proc level were being > swallowed up by Perl, causing things to no-op. > > > TclAE maps commands to the Apple IPC mechanism via this > command > > tclAE::installEventHandler{eventclass eventid cmd} > > And the Tcl command itself must take this structure: > > proc mycmd {event reply} > > The two parameters are required. > > Installing the event mapping from Perl is easy enough using > the standard Tkx calling methods: > > Tkx::tclAE__installEventHandler ("Perl", "hihi", \&hello); > > However, Perl subroutines do not provide a mechanism for > explicit parameters as far as I understand, so I had to do > this: > > sub hello { > > } > > rather than this: > > sub hello {event reply} > > I did not know how to get the event-reply args into the > Perl function and map them to Tcl. As a result, essential > data was not passed correctly, or saw swallowed up. > > Can anyone show me how to do this--to wrap a Tcl command > with args from Perl so that the args are correctly passed > to the Tcl interpreter? What is the Perl/Tcl way to access > "proc cmd {arg1 arg2}" so that arg1 and > arg2 are not lost?
I am not sure what exactly causes your problem without seeing your code, there is some guesses, There is some optimization at Tcl side, only requested "event" fields are generated, so that unneeded event fields are bypassed. This makes it necessary to pre-declare %-related events. So any event that takes %-field must have been coded like this: -foo "bar %x %y" I do not know whether your problem related to this feature or not, please show related parts of your code in problem. In case my guess is wrong, you still can always specify -foo {bar arg1 arg2} After that proc "bar" will receive needed args, Best regards, Vadim.