This module defines a class for tie()ing Tk text widgets to an array, allowing them to be accessed as if they were an array of lines.

It's not expected that anyone will actually want to populate and manipulate their text widgets this way, though you are of course free to do so. This module was created to make text widgets accessible to functions that expect an array reference as their input. (e.g. Algorithm::Diff::sdiff) You can do that with read-only support (FETCH and FETCHSIZE). All of the methods (PUSH, POP, STORE, etc.) are included for completeness.

Note: This documentation refers to "Tk text" widgets rather than "Tk::Text" ones. That's because it supports anything that uses the same API as a Tk text widget. It works with Perl/Tk and Tkx and should work with Tcl::Tk as well.

Arrays use zero-based indexing. Text widgets use one-based indexing. Ergo, line five is at index four.

Lines end in "\n". Be careful about what you add or you could get odd results. For example, doing $text[3] = 'foo' will replace the contents of line four with 'foo' but will join lines four and five because you didn't include a newline at the end of the string. Similarly, $text[3] = "foo\nbar\n" will replace line four with "foo\n" and insert "bar\n" before line five.