Re: activestate's Tcl.pm question




"Janwillem Borleffs" <jw@xxxxxxxxxxxxx> wrote in message news:47f22266$0$3012$dbd4d001@xxxxxxxxxxxxxxx
~greg schreef:
this ...
use Tcl;
my $Interpreter = new Tcl;
$Interpreter->Eval('puts "Hello world"');
$Interpreter->Eval('puts $auto_path');

puts this ...

Hello world
can't read "auto_path": no such variable at ...\test.pl line 4.


I have never used this module, but it seems that the problem is related to the use of single quotes; try instead:

$Interpreter->Eval("puts $auto_path");



No. But thank you anyway.
~~

It's tcl syntax in that Eval(), not perl syntax.

If you think about it, perl wouldn't call that kind of error.
If you print 'puts $auto_path'; in perl, you'd simply get
$auto_path.
because Perl doesn't interpolate variables in single quotes.

Like perl, tcl also uses '$' for variables (but only to get the value (R-side), and not for setting it (L-side)).

This, for example, works fine: ... use Tcl;
my $Interpreter = new Tcl;
$Interpreter->Eval('set x "Hello world"');
$Interpreter->Eval('puts $x');

It prints
Hello world

~~
Actually what I wanted was to get Tkx.pm to use Activestate's Tcl/Tk
installation instead of the tkkit.dll that they ship with Tkx.pm
(If you follow me. But don't worry if you don't. This is not a very popular subject.)

I only mentioned Tcl.pm because I knew that Tkx.pm uses Tcl.pm, so I thought it'd be easiest (or necessary) to get Tcl.pm to use Tcl/Tk first.

And I did finally get Tkx to use Tcl/Tk,
(in the sense that
use Tkx;
print join "\n", (Tkx::SplitList(Tkx::set('auto_path')));

now prints out
C:/Tcl/lib/tcl8.5
.... etc )


However, trying it again, I still can't get use Tcl;
my $Interpreter = new Tcl;
$Interpreter->Eval('puts $auto_path');

to print anything but:
can't read "auto_path": no such variable at ...

Which means I don't really understand how these things
(Tkx.pm, Tcl.pm, Tcl/Tk, tkkit.dll) are actually hooked up.


~greg

















.



Relevant Pages

  • Re: Comparing Tcl to Perl
    ... > of Tcl/Tk, which is outside corporate standards. ... > approved scripting language is Perl. ... Tcl is far better in this than Perl is. ...
    (comp.lang.tcl)
  • Re: Comparing Tcl to Perl
    ... > of Tcl/Tk, ... > approved scripting language is Perl. ... My suggestion is to avoid tcl vs perl comparison. ... Perhaps you can highlight how tcl is used in other commercial products ...
    (comp.lang.tcl)
  • "Multithreaded" tcl/tk problem?
    ... several independent Tcl/Tk ... with it's own tcl interpreter. ... processing both windows messages and Tcl events. ... Our company is using this functionality ...
    (comp.lang.tcl)
  • Re: Would like to help out...
    ... I was wondering if it is realistic to try and help fix bugs in Tcl/Tk ... learn more Tcl ... help Tcl, rather than Perl? ...
    (comp.lang.tcl)
  • Re: question about ActiveStates Tkx
    ... "Moving Tcl/Tk around with Tcl.pm", ... Install Tcl/Tk first, then install Perl module Tcl, so installed Tcl/Tk will be used. ... ActivePerl, which includes Tkx. ...
    (comp.lang.perl.tk)