NAME

Ragnetto::Console - ANSI terminal control utility

SYNOPSIS

use Ragnetto::Console qw(clear forecolor backcolor write);

clear();
forecolor('RED');
print "RAGNETTO Gabriele Secci!\n";

write("Positioned text", "GREEN", "BLACK", 10, 5);

DESCRIPTION

Ragnetto::Console provides terminal manipulation functions. It is part of the Ragnetto module suite.

FUNCTIONS

clear()

Completely clears the screen and resets the cursor to the "Home" position (1,1).

forecolor($color)

Sets the text foreground color. Accepts a number (0-15) or a color name as a string (e.g., 'RED', 'LIGHT_BLUE').

backcolor($color)

Sets the background color. Accepts a number (0-15) or a color name as a string.

cursor($state)

Manages cursor visibility. Accepts boolean values (1/0), strings ('ON'/'OFF'), or module constants.

caret($shape)

Changes the cursor shape (Caret). Accepts IDs from 1 to 6 or constants (e.g., BLOCK_BLINK, BAR_STEADY).

position($x, $y)

Moves the cursor to the specified coordinates: column ($x) and row ($y).

write($text, $fore, $back, $x, $y)

Advanced function that writes text applying colors and position in a single command. It automatically resets attributes afterward.

title($title)

Sets the terminal window title.

width()

Returns the current width of the console (number of columns).

height()

Returns the current height of the console (number of rows).

getkey()

Reads a single character from the keyboard without waiting for Enter (raw mode) and without echoing it to the screen.

putkey()

Reads a single character from the keyboard and prints it to the screen.

reset()

Restores all terminal attributes to their default values (colors, cursor visibility, and shape).

LICENSE

Copyright (C) 2026 Gabriele Secci.

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

AUTHOR

Gabriele Secci <ragnettosoftware@gmail.com>