wish in perl/Tk?
The answer is yes.
The idea of wish is that you read from <STDIN> 
and evaluate each statement. The standard way to do this in perl/Tk is to use
the tkpsh script that comes in your Tk-b#/
distribution. Another elegant way to get wish like behavior in 
perl/Tk is to use rmt which you can find in perl5/Tk/demos 
in your Tk-b# distribution. 
When you run rmt you already have Tk.pm set up for you so
you can start typing things like $mmm = new MainWindow; etc.
at the rmt: prompt.  (This use belies the power of rmt which
is derived from Ousterhout's Tcl/Tk version of rmt [see section 27.2 of
his book]. rmt is capable of "inserting Tk code" into
simultaneously running Tk applications.)
A cruder way to get wish-like behaviour with perl/Tk is to run a 
"perl shell" and type in your usual commands, including 
use Tk; etc.  There is a script distributed with perl called 
perlsh which is written quite simply as:
    #!/usr/bin/perl
     $/ = '';        # set paragraph mode
     $SHlinesep = "\n";
     while ($SHcmd = <>) {
         $/ = $SHlinesep;
         eval $SHcmd; print $@ || "\n";
         $SHlinesep = $/; $/ = ''; 
     }
You can use this during code development to test out little snippets of code.
It helps to be an accurate typist and the use strict; is optional
here :-)
Hiroaki Kobayasi has a more sophisticated wish like perl/Tk "shell" that is called EVA. It is available from:
    ftp://ftp.sowa.is.uec.ac.jp/pub/Lang/perl5/Tk/eva-*.tar.gz
Previous | Return to table of contents | Next