Term::ANSIScreen 1.42 review

Download
by rbytes.net on

Term::ANSIScreen is a Perl module for terminal control using ANSI escape sequences. SYNOPSIS # qw/:color/ is exported by de

License: Perl Artistic License
File size: 15K
Developer: Autrijus Tang
0 stars award from rbytes.net

Term::ANSIScreen is a Perl module for terminal control using ANSI escape sequences.

SYNOPSIS

# qw/:color/ is exported by default, i.e. color() & colored()

use Term::ANSIScreen qw/:color :cursor :screen :keyboard/;

print setmode(1), setkey('a','b');
print "40x25 mode now, with 'a' mapped to 'b'.";
; resetkey; setmode 3; cls;

locate 1, 1; print "@ This is (1,1)", savepos;
print locate(24,60), "@ This is (24,60)"; loadpos;
print down(2), clline, "@ This is (3,15)n";

setscroll 1, 20;

color 'black on white'; clline;
print "This line is black on white.n";
print color 'reset'; print "This text is normal.n";

print colored ("This text is bold blue.n", 'bold blue');
print "This text is normal.n";
print colored ['bold blue'], "This text is bold blue.n";
print "This text is normal.n";

use Term::ANSIScreen qw/:constants/; # constants mode
print BLUE ON GREEN . "Blue on green.n";

$Term::ANSIScreen::AUTORESET = 1;
print BOLD GREEN . ON_BLUE "Bold green on blue.", CLEAR;
print "nThis text is normal.n";

# Win32::Console emulation mode
# this returns a Win32::Console object on a Win32 platform
my $console = Term::ANSIScreen->new;
$console->Cls; # also works on non-Win32 platform

Term::ANSIScreen is a superset of Term::ANSIColor (as of version 1.04 of that module). In addition to color-sequence generating subroutines exported by :color and :constants, this module also features :cursor for cursor positioning, :screen for screen control, as well as :keyboard for key mapping.

NOTES

All subroutines in Term::ANSIScreen will print its return value if called under a void context.

The cursor position, current color, screen mode and keyboard mappings affected by Term::ANSIScreen will last after the program terminates. You might want to reset them before the end of your program.

Requirements:
Perl

Term::ANSIScreen 1.42 keywords