1PTKSH(1) perl/Tk Documentation PTKSH(1)
2
3
4
6 ptksh - Perl/Tk script to provide a graphical user interface for test‐
7 ing Perl/Tk commands and scripts.
8
10 % ptksh ?scriptfile?
11 ... version information ...
12 ptksh> $b=$mw->Button(-text=>'Hi',-command=>sub{print 'Hi'})
13 ptksh> $b->pack
14 ptksh> o $b
15 ... list of options ...
16 ptksh> help
17 ... help information ...
18 ptksh> exit
19 %
20
22 ptksh is a perl/Tk shell to enter perl commands interactively. When
23 one starts ptksh a MainWindow is automaticly created, along with a
24 ptksh command window. One can access the main window by typing com‐
25 mands using the variable $mw at the 'ptksh> ' prompt of the command
26 window.
27
28 ptksh supports command line editing and history. Just type "<Up>" at
29 the command prompt to see a history list. The last 50 commands entered
30 are saved, then reloaded into history list the next time you start
31 ptksh.
32
33 ptksh supports some convenient commands for inspecting Tk widgets. See
34 below.
35
36 To exit ptksh use: "exit".
37
38 ptksh is *not* a full symbolic debugger. To debug perl/Tk programs at
39 a low level use the more powerful perl debugger. (Just enter ``O tk''
40 on debuggers command line to start the Tk eventloop.)
41
43 History
44
45 Press <Up> (the Up Arrow) in the perlwish window to obtain a gui-based
46 history list. Press <Enter> on any history line to enter it into the
47 perlwish window. Then hit return. So, for example, repeat last com‐
48 mand is <Up><Enter><Enter>. You can quit the history window with
49 <Escape>. NOTE: history is only saved if exit is "graceful" (i.e. by
50 the "exit" command from the console or by quitting all main win‐
51 dows--NOT by interrupt).
52
53 Debugging Support
54
55 ptksh provides some convenience function to make browsing in perl/Tk
56 widget easier:
57
58 ?, or h
59 displays a short help summary.
60
61 d, or x ?args, ...?
62 Dumps recursively arguments to stdout. (see Data::Dumper). You
63 must have <Data::Dumper> installed to support this feature.
64
65 x was introduced for perl debugger compatibility.
66
67 p ?arg, ...?
68 appends "⎪\n" to each of it's arguments and prints it. If value is
69 undef, '(undef)' is printed to stdout.
70
71 o $widget ?-option ...?
72 prints the option(s) of $widget one on each line. If no options
73 are given all options of the widget are listed. See Tk::options
74 for more details on the format and contents of the returned list.
75
76 o $widget /regexp/
77 Lists options of $widget matching the regular expression regexp.
78
79 u ?class?
80 If no argument is given it lists the modules loaded by the commands
81 you executed or since the last time you called "u".
82
83 If argument is the empty string lists all modules that are loaded
84 by ptksh.
85
86 If argument is a string, ``text'' it tries to do a ``use
87 Tk::Text;''.
88
89 Packages
90
91 Ptksh compiles into package Tk::ptksh. Your code is eval'ed into pack‐
92 age main. The coolness of this is that your eval code should not
93 interfere with ptksh itself.
94
95 Multiline Commands
96
97 ptksh will accept multiline commands. Simply put a "\" character imme‐
98 diately before the newline, and ptksh will continue your command onto
99 the next line.
100
101 Source File Support
102
103 If you have a perl/Tk script that you want to do debugging on, try run‐
104 ning the command
105
106 ptksh> do 'myscript';
107
108 -- or (at shell command prompt) --
109
110 % ptksh myscript
111
112 Then use the perl/Tk commands to try out different operations on your
113 script.
114
116 Looks for your .ptksh_history in the directory specified by the $HOME
117 environment variable ($HOMEPATH on Win32 systems).
118
120 .ptksh_init
121 If found in current directory it is read in an evaluated after the
122 mainwindow $mw is created. .ptksh_init can contain any valid perl
123 code.
124
125 ~/.ptksh_history
126 Contains the last 50 lines entered in ptksh session(s).
127
129 It is best not to use "my" in the commands you type into ptksh. For
130 example "my $v" will make $v local just to the command or commands
131 entered until <Return> is pressed. For a related reason, there are no
132 file-scopy "my" variables in the ptksh code itself (else the user might
133 trounce on them by accident).
134
136 Tk::MainLoop function interactively entered or sourced in a init or
137 script file will block ptksh.
138
140 Tk perldebug
141
143 VERSION 2.03
144
146 Mike Beller <beller@penvision.com>, Achim Bohnet <ach@mpe.mpg.de>
147
148 Copyright (c) 1996 - 1998 Achim Bohnet and Mike Beller. All rights
149 reserved. This program is free software; you can redistribute it
150 and/or modify it under the same terms as Perl itself.
151
152
153
154Tk804.028 2008-02-05 PTKSH(1)