Tk::CodeText - a TextUndo widget with syntax highlighting capabilities
use Tk; require Tk::CodeText;
my $m = new MainWindow;
my $e = $m->Scrolled('CodeText', -disablemenu => 1, -syntax => 'Perl', -scrollbars => 'se', )->pack(-expand => 1, -fill => 'both');
$m->configure(-menu => $e->menu); $m->MainLoop;
Tk::CodeText inherits Tk::TextUndo and all its options and methods. Besides syntax highlighting, methods are provided for commenting and uncommenting as well as indenting and unindenting a selected area, matching pairs of braces, brackets and brackets and curlies and automatic indenting of new lines.
Syntax highlighting is done through a plugin approach. Currently there is support for Perl, Pod, HTML and Xresources. Adding languages is a matter of writing plugin modules. Theoretically this is not limited to programming languages. The plugin approach could also provide the possibility for grammar or spell checking in spoken languages.