PTKSH(1p)
π PTKSH(1p) β the perl/Tk playground shell π
okay bestie, welcome to ptksh, the perl/Tk script that hands you a whole graphical user interface just so you can test out Perl/Tk commands and scripts interactively. it's giving "REPL but make it widgets". β¨
πΈ SYNOPSIS πΈ
% ptksh ?scriptfile?
... version information ...
ptksh> $b=$mw->Button(-text=>'Hi',-command=>sub{print 'Hi'})
ptksh> $b->pack
ptksh> o $b
... list of options ...
ptksh> help
... help information ...
ptksh> exit
%
like. look at her go. π
π¦ DESCRIPTION π¦
ptksh is a perl/Tk shell where you type perl commands interactively, and it actually answers you back. when you start it up, a MainWindow gets created automatically, plus a ptksh command window. you reach the main window by typing commands with the variable $mw at the ptksh> prompt inside the command window. main character access, honestly. π
ptksh supports command line editing and history. just type <Up> at the command prompt to see a history list. the last 50 commands you entered get saved, and then reloaded into the history list the next time you start ptksh. no cap.
ptksh also supports some convenient commands for inspecting Tk widgets. see below bestie, they're iconic.
to exit ptksh use: exit.
lowkey important:ptkshis *not* a full symbolic debugger. if you wanna debug perl/Tk programs at a low level, use the more powerful perl debugger instead. (just enterO tkon the debugger's command line to start the Tk eventloop.) π
β¨ FEATURES β¨
π History
press <Up> (the Up Arrow) in the perlwish window to get a gui-based history list. press <Enter> on any history line to enter it into the perlwish window. then hit return. so, for example, repeat last command is <Up><Enter><Enter>. you can quit the history window with <Escape>. π¦
NOTE: history is only saved if exit is "graceful" (i.e. by the exit command from the console, or by quitting all main windows β NOT by interrupt). so like, don't just ctrl-C your way out and then be shocked. π
π Debugging Support
ptksh provides some convenience functions to make browsing in perl/Tk widgets easier:
?, orhβ displays a short help summary.d, orx?args, ...? β Dumps recursively arguments to stdout. (seeData::Dumper). you must have<Data::Dumper>installed to support this feature.xwas introduced for perl debugger compatibility.p?arg, ...? β appends"|\n"to each of its arguments and prints it. if the value isundef,(undef)is printed to stdout.o $widget ?-option ...?β prints the option(s) of$widget, one on each line. if no options are given, all options of the widget are listed. seeTk::optionsfor more details on the format and contents of the returned list.o $widget /regexp/β Lists options of$widgetmatching the regular expression regexp.u ?class?β if no argument is given, it lists the modules loaded by the commands you executed, or since the last time you calledu. if the argument is the empty string, it lists all modules that are loaded byptksh. if the argument is a string,text, it tries to do ause Tk::Text;.
π Packages
Ptksh compiles into package Tk::ptksh. your code is eval'ed into package main. the coolness of this is that your eval code should not interfere with ptksh itself. we love a clean separation. periodt.
β Multiline Commands
ptksh will accept multiline commands. simply put a \ character immediately before the newline, and ptksh will continue your command onto the next line. slay.
π«Ά Source File Support
if you have a perl/Tk script that you want to do debugging on, try running the command
ptksh> do 'myscript';
-- or (at shell command prompt) --
% ptksh myscript
then use the perl/Tk commands to try out different operations on your script. π§
πΈ ENVIRONMENT πΈ
looks for your .ptksh_history in the directory specified by the $HOME environment variable ($HOMEPATH on Win32 systems).
π FILES π
.ptksh_initβ if found in the current directory it is read in and evaluated after the mainwindow$mwis created..ptksh_initcan contain any valid perl code.~/.ptksh_historyβ contains the last 50 lines entered in ptksh session(s).
π PITFALLS π
it is best not to use my in the commands you type into ptksh. for example my $v will make $v local just to the command or commands entered until <Return> is pressed. for a related reason, there are no file-scopy my variables in the ptksh code itself (else the user might trounce on them by accident). protect the internals bestie. π«Ά
π BUGS π
Tk::MainLoop function interactively entered, or sourced in an init or script file, will block ptksh.
π SEE ALSO π
Tk perldebug
β VERSION β
VERSION 2.03
π AUTHORS π
Mike Beller <beller@penvision.com>, Achim Bohnet <ach@mpe.mpg.de>
Copyright (c) 1996 - 1998 Achim Bohnet and Mike Beller. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie π this little gem shipped as part of Tk version Tk804.036, dated 2025-04-13 β go forth and widget, iykyk β¨ππ¦
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms