NAME

TUI::toolkit - Unified OO facade for the TUI::Vision framework

SYNOPSIS

package Point;
use TUI::toolkit;   # has extends signature assert true false

has x => ( is => 'rw' );
has y => ( is => 'rw' );

no TUI::toolkit;  # remove keywords (has, extends, etc.) from namespace
                  # keep methods (new, dump, DESTROY)

my $p = Point->new( x => 1, y => 2 );
say $p->dump;

DESCRIPTION

TUI::toolkit provides a unified object system facade for the TUI::Vision framework. It corresponds to the functionality of TV::toolkit and offers a consistent set of OO features regardless of which backend toolkit is available.

TV::toolkit dynamically selected an OO backend from:

  • Moos Minimalistic attribute and method generator.

  • Moo Lightweight meta-object system.

  • Moose Full-featured meta-object system.

  • UNIVERSAL::Object Modern, minimal object base class.

The selection is made at compile time for each caller of use TUI::toolkit. Whichever toolkit is active, TUI::toolkit installs a consistent set of keywords and behaviors, including:

  • define true and false constants

  • assert - assertion keyword

  • has - attribute declaration

  • extends - simple class inheritance

  • signature - subroutine signature validation

  • an optional dump method, unless already present

  • a DESTROY method that dispatches DEMOLISH in MRO order

Importing of blessed and confess are not provided, but can be imported from Scalar::Util and Carp respectively.

The goal is to provide a predictable minimum OO feature set regardless of which backend toolkit is already in use.

BACKEND BEHAVIOR

If any of these toolkits are already loaded, TUI::toolkit uses them directly:

  • Moos - primary minimal backend (defaults to this when available)

  • Moo - lightweight attribute and method generator

  • Moose - full meta-object system

No attempt is made to replace or extend the backend beyond injecting dump and DESTROY when appropriate.

If none of Moos/Moo/Moose are loaded, a very small LUNIVERSAL::Object based OO layer is used.

This exists only to keep modules functional in environments where no of the other toolkits are available. It is not intended to be a full object system.

SEE ALSO

AUTHOR

J. Schneider <brickpool@cpan.org>

LICENSE

Copyright (c) 2024-2026 the "AUTHORS" as listed above.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.