NAME
Win32::ANSIConsole - Perl extension to emulate ANSI console on Win32 system.
SYNOPSIS
use Win32::ANSIConsole;
print "\e[1;34mThis text is bold blue.\e[0m\n";
print "This text is normal.\n";
print "\e[33;45;1mBold yellow on magenta.\e[0m\n";
print "This text is normal.\n";
With the Term::ANSIColor module one increases the legibility:
use Win32::ANSIConsole;
use Term::ANSIColor;
print color 'bold blue';
print "This text is bold blue.\n";
print color 'reset';
print "This text is normal.\n";
print colored ("Bold yellow on magenta.\n", 'bold yellow on_magenta');
print "This text is normal.\n";
DESCRIPTION
Windows NT/2000/XP does not support ANSI escape sequences in Win32 Console applications.
This module emulate an ANSI console for the script which uses it. Only the escape codes of the ansi.sys driver has been implemented.
Caution: this module is still in beta stage; don't use it in a production script.
Escape sequences for Cursor Movement
\e[#;#H
CUP: Cursor Position: Moves the cursor to the specified position. The first # specifies the line number, the second # specifies the column. If you do not specify a position, the cursor moves to the home position: the upper-left corner of the screen (line 0, column 0).
\e[#;#f
Works the same way as the preceding escape sequence.
\e[#A
CUU: Cursor Up: Moves the cursor up by the specified number of lines without changing columns. If the cursor is already on the top line, this sequence is ignored.
\e[#B
CUD: Cursor Down: Moves the cursor down by the specified number of lines without changing columns. If the cursor is already on the bottom line, this sequence is ignored.
\e[#C
CUF: Cursor Forward: Moves the cursor forward by the specified number of columns without changing lines. If the cursor is already in the rightmost column, this sequence is ignored.
\e[#D
CUB: Cursor Backward: Moves the cursor back by the specified number of columns without changing lines. If the cursor is already in the leftmost column, this sequence is ignored.
\e[s
SCP: Save Cursor Position: Saves the current cursor position. You can move the cursor to the saved cursor position by using the Restore Cursor Position sequence.
\e[u
RCP: Restore Cursor Position: Returns the cursor to the position stored by the Save Cursor Position sequence.
\e[2J
ED: Erase Display: Clears the screen and moves the cursor to the home position (line 0, column 0).
=item* \e[K
EL: Erase Line: Clears all characters from the cursor position to the end of the line (including the character at the cursor position).
Escape sequences for Set Graphics Rendition
\e[#;...;#m
SGM: Set Graphics Mode: Calls the graphics functions specified by the following values. These specified functions remain active until the next occurrence of this escape sequence. Graphics mode changes the colors and attributes of text (such as bold and underline) displayed on the screen.
Text attributes
0 All attributes off 1 Bold on 4 Underscore on (not implemented) 5 Blink on (not implemented) 7 Reverse video on 8 Concealed on
Foreground colors
30 Black 31 Red 32 Green 33 Yellow 34 Blue 35 Magenta 36 Cyan 37 White
Background colors
40 Black 41 Red 42 Green 43 Yellow 44 Blue 45 Magenta 46 Cyan 47 White
Escape sequences for Select Character Set
\e(U
Select null mapping - straight to character from the codepage of the console.
\e(K
Select Windows to DOS mapping, if the corresponding map exist; no effect otherwise. This is the default mapping (if the map exist, of course).
Currently, only the conversion from cp1250 (WinLatin1) to cp850 (DOSLatin1) is there processed. Contact me for other mapping.
SEE ALSO
Win32::Console, Term::ANSIColor.
AUTHOR
J-L Morel <jl_morel@bribes.org>
Home page: http://www.bribes.org/perl/wANSIConsole.html
CREDITS
Render unto Cæsar the things which are Cæsar's...
This module use the module Win32::Console. Thanks to Aldo Calpini.
The method used to overload the print function is due to Matt Sergeant (see his module Win32::ASP).
COPYRIGHT
Copyright (c) 2002 J-L Morel. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
7 POD Errors
The following errors were encountered while parsing the POD:
- Around line 251:
'=item' outside of any '=over'
- Around line 307:
You forgot a '=back' before '=head2'
- Around line 309:
'=item' outside of any '=over'
- Around line 352:
You forgot a '=back' before '=head2'
- Around line 354:
'=item' outside of any '=over'
- Around line 366:
You forgot a '=back' before '=head1'
- Around line 378:
Non-ASCII character seen before =encoding in 'Cæsar'. Assuming CP1252