๐Ÿ•ท๏ธ Ragnetto::Console

Ragnetto::Console is a lightweight Perl utility for terminal manipulation using ANSI escape sequences

It provides an easy-to-use interface for colors, cursor positioning, and non-blocking input handling.

This module is part of the ragnetto software suite.

๐Ÿš€ Features

๐Ÿ“ฆ Installation

Install the module via CPAN:

cpan Ragnetto::Console

๐Ÿ› ๏ธ Quick Start

use Ragnetto::Console qw(:all);

# Clear screen and set window title
clear();
title("Ragnetto::Console Demo");

# Write colored text at specific coordinates (X, Y)
write("Welcome to Ragnetto::Console!", "LIGHT_GREEN", "BLACK", 10, 5);

# Read a key without waiting for Enter
print "\nPress any key to exit...";
getkey();

# Reset terminal styles to default
reset();

๐Ÿ“– API Reference

| Function | Description | | :--- | :--- | | clear() | Clears the screen and resets the cursor to the home position. | | backcolor($color) | Set the background text color. | | forecolor($color) | Set the foreground text color. | | cursor($state) | Toggles cursor visibility. | | caret($shape) | Changes the cursor shape. | | position($x, $y) | Moves the cursor to the specified coordinates. | | write($text, [$f], [$b], [$x], [$y]) | Writes text with optional colors and coordinates. | | getkey() | Reads a single keypress immediately (No-echo). | | putkey() | Reads a single keypress and prints it (Echo). | | title($text) | Sets the terminal window title. | | width() | Returns the current terminal width. | | height() | Returns the current terminal height. | | reset() | Resets all styles, colors, and cursor states. |

๐Ÿ’Ž Constants

๐ŸŽจ Colors

You can use these strings for foreground (f) and background (b) parameters:

๐Ÿ–ฑ๏ธ Caret Shapes

Values for the Console::Caret(shape) function:

| Constant | Description | | :--- | :--- | | BLOCK_BLINK | Blinking block cursor | | BLOCK_STEADY | Static block cursor | | UNDER_BLINK | Blinking underline cursor | | UNDER_STEADY | Static underline cursor | | BAR_BLINK | Blinking vertical bar | | BAR_STEADY | Static vertical bar |

โš™๏ธ States

Values for Console::Cursor(state):

๐Ÿ“ License

Distributed under the MIT License. See LICENSE for more information.

Author: ragnetto-gab (Ragnettoยฎ)

E-Mail: ragnettosoftware@gmail.com