NAME

workspace.pl - A graphical multi-line shell for Perl using Tk.


SYNOPSIS

 This is a window-based multi-line shell for Perl using Tk. It intends to
 mimic the Smalltalk Workspace as well as the Lisp SMILE system.


DESCRIPTION

Multiline Shell

 Type one or more lines of Perl code into the main window and click "Do it" to
 execute that code. If the code produces some output, this output is shown. The
 grey background color indicates output mode where no commands can be entered.
 Clicking on the "Edit" / "Output" button switches between edit and output mode.

Run Perl Code from an external editor

Key Bindings

Alt-d
Executes the ``Do It'' command if in edit mode.

Alt-e
Switches between ``Edit'' and ``Output'' mode.

Alt-[Cursor up]
One step back in the command history.

Alt-[Cursor down]
One step forward in the command history.

Alt-m
Show a list with all loaded files (modules).

Alt-c
Clears the edit window if in edit mode.

Control-a
Selects the entire text.

Control-z
Undo

Control-y
Redo

Alt-h
Displays this help message.


SUBROUTINES

_ws_do_execute

Executes the Perl code displayed in the edit window. If this code produces some output, the display switches to output mode and shows the output.

If an error occurs the error messages gets displayed in the status line at the bottom of the window.

If the code was successfully executed but no output has been generated, the status line displays the hint 'Command executed'.

_ws_init

Presents some welcome message.

_ws_watch_clipboard

Watches the system clipboard for a magic command. If this magic command is present in the system clipboard, the content of the clipboard gets executed.

Useful for seamless communication with text editors.

_ws_save_history CMD

Appends the command CMD to the history array. A maximum of MAX_HISTORY entries are saved.

_ws_load_history FILE

Loads the history from FILE.

_ws_switch_mode

Toggles between edit and output mode.

_ws_show_mode MODE

Displays the window in the indicated mode.
mode == 0Output View
mode == 1Command View

_ws_history_back

One step back in the command history.

_ws_history_fwd

One step forward in the command history.

_ws_show_cmd CMD

Displays the command CMD in the edit window and set $_ws_code to CMD. (only in edit mode)

_ws_exit

Does some cleaning work just before the application is terminated.

_ws_show_modules

Show what files where loaded. (inspired by Devel::Loaded)

_ws_display_status TEXT

Displays TEXT in the status line.


_ws_display_help

Displays a help text.


TODO

rename variables to reduce the chance of conflicts
communication with text editors
 exchanging code snippets (like Lisp / SLIME)
 idea 1: via a special file for which workspace.pl is loooking every 200ms
 idea 2: using the system clipboard and a helper program, that siganls the
                        presence of a command to execute in the clipboard
graphical browser for the command history
Smalltalk-like source image
 A 'sub' can be checked into an image via Alt-i. An image is basically
 a Hash-of-Arrays, where the keys are the name of the subs. The array
 holds several versions of a sub.
intelligent history logging
 e.g. for a redefined sub just save the last definition


PREREQUISITES

 This script requires several modules:
 C<Tk>, C<Tk::CodeText>, C<Storable>, C<Tie::IxHash>, C<Data::Dumper>


AUTHOR

Stefan Fischerlaender stefanATfischerlaenderDOTde

Homepage: www.fischerlaender.de

Copyright (c) 2006 Stefan Fischerländer. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Modified versions must be clearly indicated.


VERSION

Version 0.40 - 11 Jul 2006


CHANGES

workspace-0.40.pl - 11 Jul 2006
first public release

UNIX/System_administration

mirror server hosted at Truenetwork, Russian Federation.