NAME
TUI::Dialogs::HistoryViewer::HistList - TVision style input history functions
SYNOPSIS
use TUI::Dialogs::HistoryViewer::HistList qw(
historyAdd
historyStr
historyCount
clearHistory
);
historyAdd(1, "hello");
historyAdd(1, "world");
my $count = historyCount(1);
my $first = historyStr(1, 0);
DESCRIPTION
TUI::Dialogs::HistoryViewer::HistList provides a set of functions implementing a Turbo Vision compatible input history mechanism. It is used by dialog controls such as input lines to store and retrieve previously entered values.
History entries are grouped by numeric identifiers. Each group maintains an ordered list of strings. The implementation mirrors the behavior of the original Turbo Vision history list routines, while adapting the interface to idiomatic Perl usage.
This module is purely functional. It does not define any classes or objects.
VARIABLES
The following global variables manage the internal history storage used by HistList.
$historyBlock
Reference to the history storage block. This is an array reference, not a packed string.
$historySize
Initial size of the history storage block.
$historyUsed
Number of entries currently used in the history block. This behavior follows the original Turbo Pascal implementation.
INTERNAL STRUCTURE
Internally, history entries are stored in a single list of records:
[
{ id => Int, str => Str },
{ id => Int, str => Str },
...
]
Each entry associates a history group identifier with a string value.
FUNCTIONS
historyAdd
historyAdd($id, $string);
Adds a string to the history group identified by $id.
If the string already exists in the same history group, it may be moved or reordered according to Turbo Vision history semantics.
historyCount
my $count = historyCount($id);
Returns the number of entries stored in the history group identified by $id.
historyStr
my $string = historyStr($id, $index);
Returns the string at position $index in the history group identified by $id.
If the index is out of range, an empty string is returned.
clearHistory
clearHistory();
Removes all history entries from all history groups.
initHistory
initHistory();
Initializes the history list management system.
This function clears all existing history data and prepares the internal storage structures. It is typically called automatically during application startup.
doneHistory
doneHistory();
Destroys all history data and resets the internal module state.
This function is typically called during application shutdown.
COMPATIBILITY NOTES
This module follows the Turbo Vision C++ history model and preserves its behavior and semantics.
Internally, the original implementation relied on global state and shared history storage managed by the application lifecycle. In this Perl port, the same logical behavior is retained while using Perl-native data structures and memory management.
The public interface has been adapted to idiomatic Perl usage. In particular:
State is managed internally by the module and does not require explicit memory allocation by the caller.
Strings are passed and returned directly, rather than being modified via call-by-reference parameters.
Initialization and shutdown are handled by the surrounding application framework.
These differences do not change the observable behavior of history handling, but make the interface safer and more natural to use in Perl.
IMPORTANT
The history functions are intended for use within TUI::Vision applications only. They depend on application-level initialization performed during program startup.
SEE ALSO
TUI::Dialogs::InputLine, TUI::Dialogs::HistoryViewer, TUI::App::Application
AUTHORS
Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)
COPYRIGHT AND LICENSE
Copyright (c) 1990-1994, 1997 by Borland International
Copyright (c) 2025-2026 the "AUTHORS" as listed above.
This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).