NAME

TUI::Objects::Stream - sequential stream for object serialization

SYNOPSIS

use TUI::Objects::Stream;

my $stream = new_TStream();

$stream->put( 10, 20, 30 );

my $x = $stream->get();
my $y = $stream->get();
my $z = $stream->get();

DESCRIPTION

TStream provides a lightweight sequential stream used by the Turbo Vision object persistence mechanism. Values are written with "put" and read in the same order with "get".

The interface follows the put and get operations of Pascals's Turbo Vision stream abstraction while operating on Perl values. It is used by the write and read methods of persistent framework objects.

Objects performing the TStreamable role participate in the Turbo Vision object streaming mechanism. TStream tracks object identity so that repeated references to the same object are resolved to the same reconstructed object when read back. This preserves shared references while the framework rebuilds the Turbo Vision object graph through its write and read methods.

CONSTRUCTOR

new

my $stream = TStream->new();

Creates and returns an empty stream.

new_TStream

my $stream = new_TStream();

Creates and returns an empty TStream using the Turbo Vision style factory function.

METHODS

get

my $value = $stream->get();

Removes and returns the next value from the stream.

Values are returned in the same order in which they were written with "put". References to previously read TStreamable objects are resolved to the corresponding reconstructed object, preserving object identity within the restored Turbo Vision object graph.

put

$stream->put(@values);

Writes one or more values to the stream in the order given and returns the stream object.

TStream tracks the identity of TStreamable objects. The first occurrence carries the object's persistent representation, while subsequent references are recorded so that they can be resolved to the same reconstructed object by "get". Other values are stored unchanged.

SEE ALSO

TStreamable, TUI::Manual::09

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) 2021-2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).