.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Tcl 3pm" .TH Tcl 3pm 2024-01-20 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tcl \- Tcl extension module for Perl .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Tcl; \& \& $interp = Tcl\->new; \& $interp\->Eval(\*(Aqputs "Hello world"\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The Tcl extension module gives access to the Tcl library with functionality and interface similar to the C functions of Tcl. In other words, you can .IP \(bu 4 create Tcl interpreters .Sp The Tcl interpreters so created are Perl objects whose destructors delete the interpreters cleanly when appropriate. .IP \(bu 4 execute Tcl code in an interpreter .Sp The code can come from strings, files or Perl filehandles. .IP \(bu 4 bind in new Tcl procedures .Sp The new procedures can be either C code (with addresses presumably obtained using \fIdl_open\fR and \fIdl_find_symbol\fR) or Perl subroutines (by name, reference or as anonymous subs). The (optional) deleteProc callback in the latter case is another perl subroutine which is called when the command is explicitly deleted by name or else when the destructor for the interpreter object is explicitly or implicitly called. .IP \(bu 4 Manipulate the result field of a Tcl interpreter .IP \(bu 4 Set and get values of variables in a Tcl interpreter .IP \(bu 4 Tie perl variables to variables in a Tcl interpreter .Sp The variables can be either scalars or hashes. .SS "Methods in class Tcl" .IX Subsection "Methods in class Tcl" To create a new Tcl interpreter, use .PP .Vb 1 \& $interp = Tcl\->new; .Ve .PP The following methods and routines can then be used on the Perl object returned (the object argument omitted in each case). .ie n .IP "$interp\->Init ()" 4 .el .IP "\f(CW$interp\fR\->Init ()" 4 .IX Item "$interp->Init ()" Invoke \fITcl_Init\fR on the interpreter. .ie n .IP "$interp\->CreateSlave (NAME, SAFE)" 4 .el .IP "\f(CW$interp\fR\->CreateSlave (NAME, SAFE)" 4 .IX Item "$interp->CreateSlave (NAME, SAFE)" Invoke \fITcl_CreateSlave\fR on the interpreter. Name is arbitrary. The safe variable, if true, creates a safe sandbox interpreter. See: http://www.tcl.tk/software/plugin/safetcl.html http://www.tcl.tk/man/tcl8.4/TclCmd/safe.htm .Sp This command returns a new interpreter. .ie n .IP "$interp\->Eval (STRING, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->Eval (STRING, FLAGS)" 4 .IX Item "$interp->Eval (STRING, FLAGS)" Evaluate script STRING in the interpreter. If the script returns successfully (TCL_OK) then the Perl return value corresponds to Tcl interpreter's result otherwise a \fIdie\fR exception is raised with the $@ variable corresponding to Tcl's interpreter result object. In each case, \&\fIcorresponds\fR means that if the method is called in scalar context then the string result is returned but if the method is called in list context then the result is split as a Tcl list and returned as a Perl list. The FLAGS field is optional and can be a bitwise OR of the constants Tcl::EVAL_GLOBAL or Tcl::EVAL_DIRECT. .ie n .IP "$interp\->GlobalEval (STRING)" 4 .el .IP "\f(CW$interp\fR\->GlobalEval (STRING)" 4 .IX Item "$interp->GlobalEval (STRING)" REMOVED. Evaluate script STRING at global level. Call \fIEval\fR(STRING, Tcl::EVAL_GLOBAL) instead. .ie n .IP "$interp\->EvalFile (FILENAME)" 4 .el .IP "\f(CW$interp\fR\->EvalFile (FILENAME)" 4 .IX Item "$interp->EvalFile (FILENAME)" Evaluate the contents of the file with name FILENAME. Otherwise, the same as \fIEval\fR() above. .ie n .IP "$interp\->EvalFileHandle (FILEHANDLE)" 4 .el .IP "\f(CW$interp\fR\->EvalFileHandle (FILEHANDLE)" 4 .IX Item "$interp->EvalFileHandle (FILEHANDLE)" Evaluate the contents of the Perl filehandle FILEHANDLE. Otherwise, the same as \fIEval\fR() above. Useful when using the filehandle DATA to tack on a Tcl script following an _\|_END_\|_ token. .ie n .IP "$interp\->call (PROC, ARG, ...)" 4 .el .IP "\f(CW$interp\fR\->call (PROC, ARG, ...)" 4 .IX Item "$interp->call (PROC, ARG, ...)" Looks up procedure PROC in the interpreter and invokes it using Tcl's eval semantics that does command tracing and will use the ::unknown (AUTOLOAD) mechanism. The arguments (ARG, ...) are not passed through the Tcl parser. For example, spaces embedded in any ARG will not cause it to be split into two Tcl arguments before being passed to PROC. .Sp Before invoking procedure PROC special processing is performed on ARG list: .Sp 1. All subroutine references within ARG will be substituted with Tcl name which is responsible to invoke this subroutine. This Tcl name will be created using CreateCommand subroutine (see below). .Sp 2. All references to scalars will be substituted with names of Tcl variables transformed appropriately. .Sp These first two items allow one to write and expect it to work properly such code as: .Sp .Vb 2 \& my $r = \*(Aqaaaa\*(Aq; \& button(".d", \-textvariable => \e$r, \-command=>sub {$r++}); .Ve .Sp 3. All references to hashes will be substituted with names of Tcl array variables transformed appropriately. .Sp 4. As a special case, there is a mechanism to deal with Tk's special event variables (they are mentioned as '%x', '%y' and so on throughout Tcl). When creating a subroutine reference that uses such variables, you must declare the desired variables using Tcl::Ev as the first argument to the subroutine. Example: .Sp .Vb 5 \& sub textPaste { \& my ($x,$y,$w) = @_; \& widget($w)\->insert("\e@$x,$y", $interp\->Eval(\*(Aqselection get\*(Aq)); \& } \& $widget\->bind(\*(Aq<2>\*(Aq, [\e&textPaste, Tcl::Ev(\*(Aq%x\*(Aq, \*(Aq%y\*(Aq), $widget] ); .Ve .ie n .IP "$interp\->return_ref (NAME)" 4 .el .IP "\f(CW$interp\fR\->return_ref (NAME)" 4 .IX Item "$interp->return_ref (NAME)" returns a reference corresponding to NAME, which was associated during previously called \f(CW\*(C`$interpnt\->call(...)\*(C'\fR preprocessing. As a typical example this could be variable associated with a widget. .ie n .IP "$interp\->delete_ref (NAME)" 4 .el .IP "\f(CW$interp\fR\->delete_ref (NAME)" 4 .IX Item "$interp->delete_ref (NAME)" deletes and returns a reference corresponding to NAME, which was associated during previously called \f(CW\*(C`$interpnt\->call(...)\*(C'\fR preprocessing. this follows _code_dispose about if NAME is a TClNAME or a DESCNAME. if NAME is a VARNAME then it is just deleted and returned. .ie n .IP "$interp\->icall (PROC, ARG, ...)" 4 .el .IP "\f(CW$interp\fR\->icall (PROC, ARG, ...)" 4 .IX Item "$interp->icall (PROC, ARG, ...)" Looks up procedure PROC in the interpreter and invokes it using Tcl's eval semantics that does command tracing and will use the ::unknown (AUTOLOAD) mechanism. The arguments (ARG, ...) are not passed through the Tcl parser. For example, spaces embedded in any ARG will not cause it to be split into two Tcl arguments before being passed to PROC. .Sp This is the lower-level procedure that the 'call' method uses. Arguments are converted efficiently from Perl SVs to Tcl_Objs. A Perl AV array becomes a Tcl_ListObj, an SvIV becomes a Tcl_IntObj, etc. The reverse conversion is done to the result. .ie n .IP "$interp\->invoke (PROC, ARG, ...)" 4 .el .IP "\f(CW$interp\fR\->invoke (PROC, ARG, ...)" 4 .IX Item "$interp->invoke (PROC, ARG, ...)" Looks up procedure PROC in the interpreter and invokes it directly with arguments (ARG, ...) without passing through the Tcl parser. For example, spaces embedded in any ARG will not cause it to be split into two Tcl arguments before being passed to PROC. This differs from icall/call in that it directly invokes the command name without allowing for command tracing or making use of Tcl's unknown (AUTOLOAD) mechanism. If the command does not already exist in the interpreter, an error will be thrown. .Sp Arguments are converted efficiently from Perl SVs to Tcl_Objs. A Perl AV array becomes a Tcl_ListObj, an SvIV becomes a Tcl_IntObj, etc. The reverse conversion is done to the result. .IP "Tcl::Ev (FIELD, ...)" 4 .IX Item "Tcl::Ev (FIELD, ...)" Used to declare %\-substitution variables of interest to a subroutine callback. FIELD is expected to be of the form "%#" where # is a single character, and multiple fields may be specified. Returns a blessed object that the 'call' method will recognize when it is passed as the first argument to a subroutine in a callback. See description of 'call' method for details. .ie n .IP "$interp\->result ()" 4 .el .IP "\f(CW$interp\fR\->result ()" 4 .IX Item "$interp->result ()" Returns the current Tcl interpreter result. List v. scalar context is handled as in \fIEval\fR() above. .ie n .IP "$interp\->CreateCommand (CMDNAME, CMDPROC, CLIENTDATA, DELETEPROC, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->CreateCommand (CMDNAME, CMDPROC, CLIENTDATA, DELETEPROC, FLAGS)" 4 .IX Item "$interp->CreateCommand (CMDNAME, CMDPROC, CLIENTDATA, DELETEPROC, FLAGS)" Binds a new procedure named CMDNAME into the interpreter. The CLIENTDATA and DELETEPROC arguments are optional. There are two cases: .Sp (1) CMDPROC is the address of a C function .Sp (presumably obtained using \fIdl_open\fR and \fIdl_find_symbol\fR. In this case CLIENTDATA and DELETEPROC are taken to be raw data of the ClientData and deleteProc field presumably obtained in a similar way. .Sp (2) CMDPROC is a Perl subroutine .Sp (either a sub name, a sub reference or an anonymous sub). In this case CLIENTDATA can be any perl scalar (e.g. a ref to some other data) and DELETEPROC must be a perl sub too. When CMDNAME is invoked in the Tcl interpreter, the arguments passed to the Perl sub CMDPROC are .Sp .Vb 1 \& (CLIENTDATA, INTERP, LIST) .Ve .Sp where INTERP is a Perl object for the Tcl interpreter which called out and LIST is a Perl list of the arguments CMDNAME was called with. If the 1\-bit of FLAGS is set then the 3 first arguments on the call to CMDPROC are suppressed. As usual in Tcl, the first element of the list is CMDNAME itself. When CMDNAME is deleted from the interpreter (either explicitly with \&\fIDeleteCommand\fR or because the destructor for the interpreter object is called), it is passed the single argument CLIENTDATA. .ie n .IP "$interp\->DeleteCommand (CMDNAME)" 4 .el .IP "\f(CW$interp\fR\->DeleteCommand (CMDNAME)" 4 .IX Item "$interp->DeleteCommand (CMDNAME)" Deletes command CMDNAME from the interpreter. If the command was created with a DELETEPROC (see \fICreateCommand\fR above), then it is invoked at this point. When a Tcl interpreter object is destroyed either explicitly or implicitly, an implicit \fIDeleteCommand\fR happens on all its currently registered commands. .ie n .IP "(TCLNAME,GENCODE) = $interp\->create_tcl_sub(CODEREF, EVENTS, TCLNAME, DESCRNAME)" 4 .el .IP "(TCLNAME,GENCODE) = \f(CW$interp\fR\->create_tcl_sub(CODEREF, EVENTS, TCLNAME, DESCRNAME)" 4 .IX Item "(TCLNAME,GENCODE) = $interp->create_tcl_sub(CODEREF, EVENTS, TCLNAME, DESCRNAME)" Creates a COMMAND called TCLNAME calling CODEREF in the interpreter \f(CW$interp\fR, and adds it to the internal tracking structure. DESCRNAME and TCLNAME should not begin with \f(CW\*(C`=\*(C'\fR or \f(CW\*(C`@\*(C'\fR or \f(CW\*(C`::perl::\*(C'\fR to avoid collisions. If TCLNAME IS blank or undef, it is constructed from the CODEREF address. GENCODE starts as TCLNAME but gets @$EVENTS which can contain \f(CW%vars\fR joined to it. .Sp TCLNAME and DESCRNAME get stored in an internal structure, and can be used to purge things from the command table via code_destroy or \f(CW$interp\fR\->delete_ref; .Sp Returns (TCLNAME,GENCODE). if you are creating code refs with this you can continue to use the same coderef and it will be converted on each call. but if you save GENCODE, you can replace the anon-coderef call in the tcl command with GENCODE. .Sp for instance .Sp .Vb 1 \& $interp\->call(\*(AqFILEEVENT\*(Aq,$fileref,WRITABLE=>sub {...}); .Ve .Sp can be replaced by .Sp .Vb 2 \& my ($tclcode,$gencode)=$interp\->create_tcl_sub(sub{...}, EVENTS, TCLNAME, DESCRNAME); \& $interp\->call(\*(AqFILEEVENT\*(Aq,$gencode,WRITABLE=>$gencode); .Ve .Sp or .Sp .Vb 2 \& my $sub=sub{....}; \& $interp\->call(\*(AqFILEEVENT\*(Aq,$fileref,WRITABLE=>$sub); .Ve .Sp can be replaced by .Sp .Vb 2 \& my ($tclcode,$gencode)=$interp\->create_tcl_sub($sub, EVENTS, TCLNAME, DESCRNAME); \& $interp\->call(\*(AqFILEEVENT\*(Aq,$gencode,WRITABLE=>$gencode); .Ve .Sp although .Sp .Vb 1 \& $interp\->call(\*(AqFILEEVENT\*(Aq,$fileref,WRITABLE=>$sub); .Ve .Sp will still work fine, too. .Sp Then you later call .Sp .Vb 1 \& $interp\->delete_ref($tclname); .Ve .Sp when you are finished with that sub to clean it from the internal tracking and command table. This means no automatic cleanup will occur on the sub{...} or \f(CW$sub\fR .Sp And after the destroy inside Tcl any triggering writable on \f(CW$fileref\fR will fail as well. so it should be replaced first via \f(CW$interp\fR\->call('FILEEVENT',$fileref,WRITABLE=>''); .IP "(CODEREF) = Tcl::_code_dispose(NAME)" 4 .IX Item "(CODEREF) = Tcl::_code_dispose(NAME)" Purges the internal table of a NAME and may initiate destruction of something created thru call or create_tcl_sub .Sp TCLNAME and DESCRNAME get stored in an internal structure, and can be used to purge things form the command table. calling _code_dispose on a TCLNAME returned from create_tcl_sub removes all use instances and purges the command table. calling _code_dispose on a DESCRNAME passed to create_tcl_sub removes only that instance Code used in a DESCRNAME may be used in other places as well, only when the last usage is purged does the entry get purged from the command table .Sp While the internal tracking structure saves the INTERP the code was added to, it itself does not keep things separated by INTERP, A TCLNAME or DESCRNAME can only exist in one INTERP at a time, using a new INTERP just causes the one in the last INTERP to disappear, and probably end up with the Tcl code getting deleted .Sp Returns (CODEREF), this is the original coderef .ie n .IP "$interp\->SetResult (STRING)" 4 .el .IP "\f(CW$interp\fR\->SetResult (STRING)" 4 .IX Item "$interp->SetResult (STRING)" Sets Tcl interpreter result to STRING. .ie n .IP "$interp\->AppendResult (LIST)" 4 .el .IP "\f(CW$interp\fR\->AppendResult (LIST)" 4 .IX Item "$interp->AppendResult (LIST)" Appends each element of LIST to Tcl's interpreter result object. .ie n .IP "$interp\->AppendElement (STRING)" 4 .el .IP "\f(CW$interp\fR\->AppendElement (STRING)" 4 .IX Item "$interp->AppendElement (STRING)" Appends STRING to Tcl interpreter result object as an extra Tcl list element. .ie n .IP "$interp\->ResetResult ()" 4 .el .IP "\f(CW$interp\fR\->ResetResult ()" 4 .IX Item "$interp->ResetResult ()" Resets Tcl interpreter result. .ie n .IP "$interp\->SplitList (STRING)" 4 .el .IP "\f(CW$interp\fR\->SplitList (STRING)" 4 .IX Item "$interp->SplitList (STRING)" Splits STRING as a Tcl list. Returns a Perl list or the empty list if there was an error (i.e. STRING was not a properly formed Tcl list). In the latter case, the error message is left in Tcl's interpreter result object. .ie n .IP "$interp\->SetVar (VARNAME, VALUE, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->SetVar (VARNAME, VALUE, FLAGS)" 4 .IX Item "$interp->SetVar (VARNAME, VALUE, FLAGS)" The FLAGS field is optional. Sets Tcl variable VARNAME in the interpreter to VALUE. The FLAGS argument is the usual Tcl one and can be a bitwise OR of the constants Tcl::GLOBAL_ONLY, Tcl::LEAVE_ERR_MSG, Tcl::APPEND_VALUE, Tcl::LIST_ELEMENT. .ie n .IP "$interp\->SetVar2 (VARNAME1, VARNAME2, VALUE, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->SetVar2 (VARNAME1, VARNAME2, VALUE, FLAGS)" 4 .IX Item "$interp->SetVar2 (VARNAME1, VARNAME2, VALUE, FLAGS)" Sets the element VARNAME1(VARNAME2) of a Tcl array to VALUE. The optional argument FLAGS behaves as in \fISetVar\fR above. .ie n .IP "$interp\->GetVar (VARNAME, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->GetVar (VARNAME, FLAGS)" 4 .IX Item "$interp->GetVar (VARNAME, FLAGS)" Returns the value of Tcl variable VARNAME. The optional argument FLAGS behaves as in \fISetVar\fR above. .ie n .IP "$interp\->GetVar2 (VARNAME1, VARNAME2, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->GetVar2 (VARNAME1, VARNAME2, FLAGS)" 4 .IX Item "$interp->GetVar2 (VARNAME1, VARNAME2, FLAGS)" Returns the value of the element VARNAME1(VARNAME2) of a Tcl array. The optional argument FLAGS behaves as in \fISetVar\fR above. .ie n .IP "$interp\->UnsetVar (VARNAME, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->UnsetVar (VARNAME, FLAGS)" 4 .IX Item "$interp->UnsetVar (VARNAME, FLAGS)" Unsets Tcl variable VARNAME. The optional argument FLAGS behaves as in \fISetVar\fR above. .ie n .IP "$interp\->UnsetVar2 (VARNAME1, VARNAME2, FLAGS)" 4 .el .IP "\f(CW$interp\fR\->UnsetVar2 (VARNAME1, VARNAME2, FLAGS)" 4 .IX Item "$interp->UnsetVar2 (VARNAME1, VARNAME2, FLAGS)" Unsets the element VARNAME1(VARNAME2) of a Tcl array. The optional argument FLAGS behaves as in \fISetVar\fR above. .ie n .IP "$interp\->InterpDeleted ()" 4 .el .IP "\f(CW$interp\fR\->InterpDeleted ()" 4 .IX Item "$interp->InterpDeleted ()" See Tcl C API documentation for \fITcl_InterpDeleted\fR(). .SS "Linking Perl and Tcl variables" .IX Subsection "Linking Perl and Tcl variables" You can \fItie\fR a Perl variable (scalar or hash) into class Tcl::Var so that changes to a Tcl variable automatically "change" the value of the Perl variable. In fact, as usual with Perl tied variables, its current value is just fetched from the Tcl variable when needed and setting the Perl variable triggers the setting of the Tcl variable. .PP To tie a Perl scalar \fR\f(CI$scalar\fR\fI\fR to the Tcl variable \fItclscalar\fR in interpreter \fI\fR\f(CI$interp\fR\fI\fR with optional flags \fI\fR\f(CI$flags\fR\fI\fR (see \fISetVar\fR above), use .PP .Vb 1 \& tie $scalar, "Tcl::Var", $interp, "tclscalar", $flags; .Ve .PP Omit the \fR\f(CI$flags\fR\fI\fR argument if not wanted. .PP To tie a Perl hash \fR\f(CI%hash\fR\fI\fR to the Tcl array variable \fIarray\fR in interpreter \fI\fR\f(CI$interp\fR\fI\fR with optional flags \fI\fR\f(CI$flags\fR\fI\fR (see \fISetVar\fR above), use .PP .Vb 1 \& tie %hash, "Tcl::Var", $interp, "array", $flags; .Ve .PP Omit the \fR\f(CI$flags\fR\fI\fR argument if not wanted. Any alteration to Perl variable \fI\fR\f(CI$hash\fR\fI{"key"}\fR affects the Tcl variable \fIarray(key)\fR and \fIvice versa\fR. .SS "Accessing Perl from within Tcl" .IX Subsection "Accessing Perl from within Tcl" After creation of Tcl interpreter, in addition to evaluation of Tcl/Tk commands within Perl, other way round also instantiated. Within a special namespace \f(CW\*(C` ::perl \*(C'\fR following objects are created: .PP .Vb 1 \& ::perl::Eval .Ve .PP So it is possible to use Perl objects from within Tcl. .SH "Other Tcl interpreter methods" .IX Header "Other Tcl interpreter methods" .IP "export_to_tcl method" 2 .IX Item "export_to_tcl method" An interpreter method, export_to_tcl, is used to expose a number of perl subroutines and variables all at once into tcl/tk. .Sp \&\fBexport_to_tcl\fR takes a hash as arguments, which represents named parameters, with following allowed values: .RS 2 .IP "\fBnamespace\fR => '...'" 4 .IX Item "namespace => '...'" tcl namespace, where commands and variables are to be created, defaults to 'perl'. If '' is specified \- then global namespace is used. A possible '::' at end is stripped. .IP "\fBsubs\fR => { ... }" 4 .IX Item "subs => { ... }" anonymous hash of subs to be created in Tcl, in the form /tcl name/ => /code ref/ .IP "\fBvars\fR => { ... }" 4 .IX Item "vars => { ... }" anonymous hash of vars to be created in Tcl, in the form /tcl name/ => /code ref/ .IP "\fBsubs_from\fR => '...'" 4 .IX Item "subs_from => '...'" a name of Perl namespace, from where all existing subroutines will be searched and Tcl command will be created for each of them. .IP "\fBvars_from\fR => '...'" 4 .IX Item "vars_from => '...'" a name of Perl namespace, from where all existing variables will be searched, and each such variable will be tied to Tcl. .RE .RS 2 .Sp An example: .Sp .Vb 2 \& use strict; \& use Tcl; \& \& my $int = Tcl\->new; \& \& $tcl::foo = \*(Aqqwerty\*(Aq; \& $int\->export_to_tcl(subs_from=>\*(Aqtcl\*(Aq,vars_from=>\*(Aqtcl\*(Aq); \& \& $int\->Eval(<<\*(AqEOS\*(Aq); \& package require Tk \& \& button .b1 \-text {a fluffy button} \-command perl::fluffy_sub \& button .b2 \-text {a foo button} \-command perl::foo \& entry .e \-textvariable perl::foo \& pack .b1 .b2 .e \& focus .b2 \& \& tkwait window . \& EOS \& \& sub tcl::fluffy_sub { \& print "Hi, I am a fluffy sub\en"; \& } \& sub tcl::foo { \& print "Hi, I am foo\en"; \& $tcl::foo++; \& } .Ve .RE .IP \fBexport_tcl_namespace\fR 2 .IX Item "export_tcl_namespace" extra convenience sub, binds to tcl all subs and vars from perl \fBtcl::\fR namespace .SH AUTHORS .IX Header "AUTHORS" .Vb 4 \& Malcolm Beattie, 23 Oct 1994 \& Vadim Konovalov, 19 May 2003 \& Jeff Hobbs, jeff (a) activestate . com, 22 Mar 2004 \& Gisle Aas, gisle (a) activestate . com, 14 Apr 2004 .Ve .PP Special thanks for contributions to Jan Dubois, Slaven Rezic, Paul Cochrane, Huck Finn, Christopher Chavez, SJ Luo. .SH COPYRIGHT .IX Header "COPYRIGHT" This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See http://www.perl.com/perl/misc/Artistic.html