Wrap Tcl args in Perl subroutne

[email protected] (Kevin Walzer) Wed, 03 Jun 2015 10:17:43 -0400
Newsgroups perl.tcltk
Organization WordTech Communications LLC
Message-ID <[email protected]>
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?

--Kevin

-- 
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com