NAME
Term::Shelly - Yet Another Shell Kit for Perl
VERSION
$Id: Shelly.pm,v 1.5 2004/06/04 04:21:23 psionic Exp $
GOAL
I needed a shell kit for an aim client I was writing. All of the Term::ReadLine modules are do blocking reads in doing their readline() functions, and as such are entirely unacceptable. This module is an effort on my part to provide the advanced functionality of great ReadLine modules like Zoid into a package that's more flexible, extendable, and most importantly, allows nonblocking reads to allow other things to happen at the same time.
NEEDS
- Settable key bindings - Tab completion - Support for window size changes (sigwinch) - movement in-line editing. - vi mode (Yeah, I lub vi) - history - Completion function calls
- Settable callbacks for when we have an end-of-line (EOL binding?)
DESCRIPTION
$sh->do_one_loop()
Does... one... loop. Makes a pass at grabbing input and processing it. For speedy pasts, this loops until there are no characters left to read. It will handle event processing, etc.
handle_key($key)
Handle a single character input. This is not a "key press" so much as doing all the necessary things to handle key presses.
execute_binding(raw_key)
Guess what this does? Ok I'll explain anyway... It takes a key and prettifies it, then checks the known key bindings for a mapping and checks if that mapping is a coderef (a function reference). If it is, it'll call that function. If not, it'll do nothing. If it finds a binding for which there is no mapped function, it'll tell you that it is an unimplemented function.
prettify_key(raw_key)
This happy function lets me turn raw input into something less ugly. It turns control keys into their equivalent ^X form. It does some other things to turn the key into something more readable
real_out($string)
This function allows you to bypass any sort of evil shenanigans regarding output fudging. All this does is 'print @_;'
Don't use this unless you know what you're doing.
fix_inputline
This super-happy function redraws the input line. If input_position is beyond the bounds of the terminal, it'll shuffle around so that it can display it. This function is called just about any time any key is hit.
$sh->complete_word
This is called whenever the complete-word binding is triggered. See the COMPLETION section below for how to write your own completion function.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 68:
You can't have =items (as at line 134) unless the first thing after the =over is an =item