The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ptksh - Simple perl/Tk shell with cmd line editing and a persistent history

SYNOPSIS

  % ptksh  ?I<scriptfile>?
  ... version informations ...
  ptksh> $b=$mw->Button(-text=>'Hi',-command=>sub{print 'Hi'})
  ptksh> $b->grid
  ptksh> o $b
  ... list of options ...
  ptksh> ...
  ptksh> ^D
  %

DESCRIPTION

ptksh is a simple perl/Tk shell to enter perl commands interactively. When one starts ptksh a MainWindow is automaticly created. One can access it with $mw on the command line.

ptksh supports command line editing and history via ReadLine interface (see Term::ReadLine). The last 50 commands entered are saved on exit to ~/.ptksh_history. The history file is loaded into history cache the next time you start ptksh.

To exit ptksh use: ^D, exit, or quit.

The primary target of ptksh is to experiment with perl/Tk widgets. To debug perl/Tk programs use the more powerful the perl debugger. Just enter ``O tk'' on debuggers command line to start the Tk eventloop. The only advantage ptksh has is that history file support and that a MainWindow is automaticly created.

DEBUGGING SUPPORT

ptksh provides some convenience function to make browsing in perl/Tk widget easier:

?

displays a short help summary.

d ?args, ...?

Dumps recursicely arguments to stdout. (see Data::Dumper).

p ?arg, ...?

appends "|\n" to each of it's arguments and prints it. If value is undef, '(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. See Tk::options for more details on the format and contents of the returned list.

o $widget /regexp/

Lists options of $widget matching 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 called u.

If argument is the empty string lists all modules that are loaded by ptksh.

If argument is a string, ``text'' it tried does a ``use Tk::Text''.

ENVIRONMENT

Same as for Term::ReadLine and perl. See Term::ReadLine and "ENVIRONMENT" in perlrun for further details.

FILES

.ptksh_init

If found in current directory it is read in an evaluated after the mainwindow $mw is created. .ptksh_init can contain any valid perl code.

~/.ptksh_history

Contains the last 50 lines entered in ptksh session(s).

BUGS

Term::Readline::Perl command line history is broken when used in conjunction with perl/Tk. Term::ReadLine::Gnu has no problems.

Tk::MainLoop function interactively entered or sourced in a init or script file will block ptksh.

SEE ALSO

Tk Term::ReadLine perldebug

AUTHOR

Achim Bohnet <ach@mpe.mpg.de>

Copyright (c) 1996-1998 Achim Bohnet. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.