Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Tcl::Tk - Tie Hash to Tcl Array and assign hash

by Courage (Parson)
on Jan 20, 2005 at 21:15 UTC ( [id://423794]=note: print w/replies, xml ) Need Help??


in reply to Tcl::Tk - Tie Hash to Tcl Array and assign hash

Usually you do not go to such a low level of programming when using Tcl::Tk.

Normally, you use perlTk syntax, while using *all* features of all requested package (Tix, or any other)

On the other side, looks like tie-ing hashes does not currently fully implemented. Probably because it is rarely needed to do such kind of mapping.

I assume this lacking method you found will be fixed within next version of Tcl module, meanwhile you can enter to Tcl::Var package (within Tcl.pm):

sub CLEAR { my $obj = shift; die "STORE Usage: objdata @{$obj} $#{$obj}, not 2 or 3 (@_)" unless @{$obj} == 2 || @{$obj} == 3; my ($interp, $varname, $flags) = @$obj; $interp->Eval("array set $varname {}"); }
But you'll probably need more hash methods afterwards (FIRSTKEY for example).

PS. Also all we keep in mind, that Tcl's array is not an array in Perl's terminology, its a hash.

Best regards,
Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re^2: Tcl::Tk - Tie Hash to Tcl Array and assign hash
by Ardemus (Beadle) on Jan 26, 2005 at 18:51 UTC
    Thanks Courage. You were right, I had gotten off track. I was developing my new GUI elements in pure embedded TCL. After your comment, I stopped and re-assessed my design, ultimately reworking it to be primarily perl/tk syntax.

    However, the understanding of TCL has proved quite helpful.

      I completely agree with all your statements.
      Moreover, if you'll delve into internals of perlTk (without Tcl) you will see more complicated things than just dealing with Tcl syntax, but dealing with Tcl within Tcl::Tk module isn't hard, rather interesting.

      BTW it appeared I needed similar tied hashes recently, so I made them work, at least in a first approximation. You can watch that at CVS http://cvs.sourceforge.net/viewcvs.py/tcltkce/#dirlist or wait for next CPAN release, which is hopefully will be within a week.

      Best regards,
      Courage, the Cowardly Dog

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://423794]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-26 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found