SpecPerl 0.2 This package contains two scripts for producing perl/Tk output from specTcl. This should be considered a beta release; I have created and tested the scripts using perl 5.003 and Tk400.202 on a DEC Alpha running Digital Unix 4.0a. I am skeptical that it would run on a much earlier version of Tk, as the grid geometry manager used here is relatively new and experimental. In particular, don't expect this to be useful on a Mac or PC, as the perl/Tk is broken or nonexistent there. Your mileage may vary. Changes: 0.1 to 0.2 - better handling of variables and textvariables entered via the widget configuration dialog - better handling of attached scrollbars and other widget containing commands - now works correctly with files in other directories. This is still a bug in specTcl, but is now fixed in specPerl :) (Achim Bohnet and Stephen O. Lidie) - encapsulated MainWindow object $top in wrapper code; perl -w -Mstrict hello.ui.pl now passes (Larry Virden) - a number of less significant changes I would like to thank Achim Bohnet, Stephen O. Lidie, and Larry Virden for their comments on and testing of specPerl 0.1. Unbeknownst to me, Achim and Stephen were also working a specPerl project and graciously allowed me to peruse their code. In doing so, I discovered the third bug above and also made several improvements to my perl code generation. With their code folded into mine, this specPerl will become the "official" version. Installation: 0) get the SpecTcl distribution from http://www.sunlabs.com/research/tcl/spectcl/ and thank Stephen Uhler and Ken Corey for making the source available. Unpacking it yields the directories SpecTcl1.0/ SpecTcl1.0/SpecTcl/ SpecTcl1.0/bin 1) move the script SpecTcl1.0/SpecTcl/perl_init.tk to SpecTcl1.0/SpecTcl/perl_init.tk.old copy the script perl_init.tk to SpecTcl1.0/SpecTcl/perl_init.tk copy the script specPerl to SpecTcl1.0/bin/specPerl 2) edit the file specPerl and change the line DIR=/home/kvale/tcltk/SpecTcl1.0/SpecTcl to the corresponding directory on your machine. Running specPerl: specPerl runs in pretty much the same way as specTcl does, so the online help is applicable for specPerl as well. When saving project foo, specPerl produces two files: foo.ui and foo.ui.pl. One can test the Tk perl script by pressing the execute button or "Build Perl" in the Commands menu. One kills the running script by pressing the Stop button or the "Kill Perl" entry in the Commands menu. Note that in addition to "Save" and "Save As", "Build Perl" also saves the project. Once the Two projects are included in the package: hello.ui, hello.ui.pl - the canonical Tk project trip.ui, trip.ui.pl - a nonsensical, but gnarly trip test for specPerl In fact, trip.ui is gnarly enough to pick out three bugs: 1) when executing specTcl trip.ui, one cannot modify the text of the "exit" button. (This is a intermittent problem.) 2) run specPerl trip.ui and build a perl test. When you press on either menu button, you get the message Tk::Error: Can't locate object method "Unpost" via package "Tk::Menu" at /home/kvale/lib/perl5/site_perl/auto/Tk/Menubutton/ButtonUp.al line 14. (command bound to event) at /home/kvale/lib/perl5/site_perl/auto/Tk/Error.al line 13. ****late breaking news: 10/9/97 - I added require Tk::Menu; to the wrapper, so that this warning no longer occurs. ***** The perl/Tk code looks ok, and the corresponding tcl code gives no error. Another bug, courtesy of Larry Virden : 3) if one executes perl -w trip.ui.pl, one gets the following message on startup: Use of uninitialized value at /home/kvale/lib/perl5/site_perl/Tk/Widget.pm line 183. Use of uninitialized value at /home/kvale/lib/perl5/site_perl/Tk/Widget.pm line 183. If one then runs the cursor through either of the scale widgets, one gets many Use of uninitialized value at /home/kvale/lib/perl5/site_perl/auto/Tk/Scale/Activate.al line 19. perl/Tk notes: In general, the perl code produced by specPerl is a close counterpart to the tcl code produced by specTcl. The main difference lies in two places: - the wrapper around the subroutine. The Tk400.202 distribution has a bug in the grid geometry manager: the gridRowconfigure and gridColumnconfigure methods do not work with the MainWindow object, so I put all the widgets in a Frame in the MainWindow object. I'll change this when the grid manager gets fixed. - the widget commands. When, e.g., attaching scrollbars to a text widget in Tcl/Tk, one can create -commands involving undefined widgets with impunity, as long as those widgets are defined by the time the -command gets executed. In perl/Tk by contrast, the widgets need to be defined before they are used in a -command. In specPerl, this is handled by creating all the widgets first, and then further configuring all the widgets with -command type options. I would enjoy hearing your comments, what you are building with specPerl, bug reports and fixes, etc. My address is kvale@phy.ucsf.edu Enjoy! -Mark