Term::Shelly - Yet Another Shell Kit for Perl
$Id: Shelly.pm,v 1.5 2004/06/04 04:21:23 psionic Exp $
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.
- 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?)
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 a single character input. This is not a "key press" so much as doing all the necessary things to handle key presses.
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.
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
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.
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.
This is called whenever the complete-word binding is triggered. See the COMPLETION section below for how to write your own completion function.