Getting Started with Perl/Tk
Enough history. The remainder of this chapter is about the basics of using Perl/Tk, including how to create simple widgets and display them, a quick introduction to event-based programming, and an obligatory “Hello World” example. Before we continue, let’s make sure you have everything installed properly.
Do You Need To Install Anything?
Since the Tk extension to Perl doesn’t come with the standard Perl distribution, the first thing you should do is make sure you have a working Perl/Tk distribution.
Whether you’re running Unix or Win32, the perl program should be in your path. Type the following at a command prompt to make the determination:
%
perl -vIf you receive a “command not found” error message, see Appendix A and install Perl. If perl is found, you’ll see output similar to this:
This is perl, v5.6.0 built for i686-linux Copyright 1987-2000, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5.0 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page.
In particular, note the version number in the first line; anything earlier than 5.6.0 may not produce the results depicted in this book. Perl 5.005_03 may work, but nothing earlier will, guaranteed.
Now determine if the Tk ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access