J.A. de Vries > Term-ANSIMenu > Term::ANSIMenu

Download:
Term-ANSIMenu-0.02.tar.gz

Dependencies

Annotate this POD (1)

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Term::ANSIMenu - An infrastructure for creating menus in ANSI capable terminals

VERSION ^

This documenation describes version 0.01 of Term::ANSIMenu as released on Thursday, April 17, 2003.

SYNOPSIS ^

  use Term::ANSIMenu;
  my $menu = Term::ANSIMenu->new(
                               width  => 40,
                               help   => [['', \&standard_help],
                                          ['hint 1', \&help_item],
                                          [ undef, \&standard_help],
                                          ['hint 3', undef]
                                         ],
                               title  => 'title',
                               items  => [['1', 'First menu item', \&exec_item],
                                          ['2', 'This string is just too long \
                                                 to fit in a normal terminal \
                                                 and thus it will be clipped.'],
                                          ['3', '', sub { system "man man" }]
                                         ],
                               status => 'status',
                               prompt => 'prompt: ');

  $menu->print_menu();
  while (my $key = $menu->read_key()) {
    last unless defined $menu->do_key($key);
    $menu->update_status('') if $key eq 'S';
    $menu->update_status('New status') if $key eq 's';
    $menu->update_prompt('') if $key eq 'P';
    $menu->update_prompt('New prompt: ') if $key eq 'p';
  }
  $menu->pos($menu->line_after_menu() + 1, 1);

DESCRIPTION ^

I wrote this mainly to make live easy on those staff members to whom I delegate tasks. Most of them prefer to use a menu instead of having to type complicated commands. To them it's a faster and safer way of working (we all know about typos don't we...).

By using this module you can create menus with only a few lines of code and still have a shipload of features. Need context-sensitive help or a statusbar? Like to use hotkeys? Want flashy colors and styles? It's all there. Just fill in the attributes and you're good to go.

Overview

A menu can be made up of a title, a number of selectable items, a status line and a prompt. Each of those elements can be given a fore- and background color and a style to give it the appearance wanted. The same goes for the optional frames around these elements. It is also possible to align each element independently (but the all items together are considered as one element).

Every item in the menu can be selected using definable hotkeys or navigation keys. To assist users of the menu hints that will be diplayed in the status line can be associated with itemsi. For situations where a simple hint isn't good enough context-sensitive help is available through definable keys (like the well-known <F1> and '?').

Finally to get out of the menu without having to explicitly create an entry for that one or more keys can be assigned that will cause an immediate return from the menu to the calling program. The exit status reflects the conditions under which that happened.

On to the gory details...

Creating and destroying Term::ANSIMenu objects

A Term::ANSIMenu object is created with the usual call to new(), like this

  $menu = Term::ANSIMenu->new();

This will create an object with reasonable defaults. However some attributes still have to be explicitly given before the resulting object makes a sensible menu. Everything is optional, except for the selectable items that make up the menu. You can do this either directly in the call to the constructor or by using the corresponding mutator. Attributes can be set through new() by specifying their name as a hash key and giving it an appropriate value.

For example:

  $menu = Term::ANSIMenu->new(items => [['1', 'First menu item', \&exec_item],
                                        ['2', 'This string is just too long \
                                               to fit in a normal terminal \
                                               and thus it will be clipped.'],
                                        ['3', '', sub { system "man man" }]
                                       ]);

See the next section for a list of all mutators and the conditions they impose on their values.

The call to new() will also initialize the terminal by setting it to VT100 mode. After that it will clear the screen and position the cursor in the upper-left corner.

Upon destroying the object the destructor will restore the normal settings of the terminal by setting the readmode back to 0 and by explicitly removing any ANSI attributes and turning the cursor on. The screen is not cleared unless the menu was explicitly instructed to do so.

Attributes

Attributes can be accessed by using a method that will function as both a accessor and a mutator. The name of that method is exactly the same as the name of the corresponding attribute. In other words the value of an attribute can be read using

  $menu->attrib()

Its value can be changed like this:

  $menu->attrib($value)

Both calls return the current value (after setting it). If the return value is a list then it will be given as a list or as a reference to that list, depending on the context. For example:

  $return_ref = $menu->attrib([<list>]);
  @return_list = $menu->attrib([<list>]);

The attributes listed below are publicly available through such methods.

width()

The width of the menu.

  Type: integer
  Constraints: must be > 0 and <= than the current terminal width
  Default: <term_width>

height()

The height of the menu. This is ignored at the moment, but might be used in a future version.

  Type: integer
  Constraints: must be > 0 and <= than the current terminal height
  Default: <term_height>

space_after_title()

Print an empty line as a spacer after the title.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

space_after_items()

Print an empty line as a spacer after the selectable items.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

space_after_status()

Print an empty line as a spacer after the status line.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 0

spacious_items()

Print frame lines between the selectable items.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 0

cursor()

Make the cursor visible when a prompt is printed.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

cursor_char()

A single character to print at the cursor position in the prompt if the cursor is visible.

  Type: char
  Constraints: must be a single printable character or a space
  Default: '?'

up_keys()

A list of key names that will move the current selection to the previous item.

  Type: array
  Constraints: elements must be a single character or a special key name
  Default: ['UP', 'PGUP', 'LEFT']

down_keys()

A list of key names that will move the current selection to the next item.

  Type: array
  Constraints: elements must be a single character or a special key name
  Default: ['DOWN', 'PGDN', 'RIGHT']

exit_keys()

A list of key names that will exit the menu.

  Type: array
  Constraints: elements must be a single character or a special key name
  Default: ['q', 'Q', 'CTRL-c']

help_keys()

A list of key names that will invoke context-sensitive help.

  Type: array
  Constraints: elements must be a single character or a special key name
  Default: ['F1', '?']

help()

A list of hints and references to routines that provide additional help to the user. The first array element is used when no item is selected, the order of the other elements corresponds with the order of the selectable items.

The hint must be a string of printable characters (including spaces). The code reference should point to a routine that will provide help. It is called with the number of the currently selected item as an argument.

If a hint is undefined or an empty string no information will be provided through the status line. If no code reference is defined help will not be available for that particular item.

  Type: array of arrays
  Constraints: [[<hint>, <code_ref>], ...]
  Default: []

selection()

The number of the currently selected item. If no item is selected this will be 0.

  Type: integer
  Constraints: must be >= 0 and <= than the number of selectable items.
  Default: 0

selection_keys()

A list of key names that will execute the current selection.

  Type: array
  Constraints: elements must be a single character or a special key name
  Default: ['SPACE', 'ENTER']

selection_wrap()

Wrap around to the other end of the list when trying to move beyond the first or last entry.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

selection_style()

Apply these character attributes to the selected item.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD, UNDERLINE and CLEAR
  Default: ['REVERSE']

selection_fgcolor()

Apply this foreground color to the selected item.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

selection_bgcolor()

Apply this background color to the selected item.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

leader()

Print a line resembling the top of a frame before the list of items. The is used only when no frame is drawn around the list of items.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 0

leader_delimiter()

Print this character in the leader at the position where the delimiter between hotkey and description is printed in the list of items.

  Type: char
  Constraints: must be a single character which may be a line drawing character.
  Default: ''

trailer()

Print a line resembling the bottom of a frame after the list of items. The is used only when no frame is drawn around the list of items.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 0

trailer_delimiter()

Print this character in the trailer at the position where the delimiter between hotkey and description is printed in the list of items.

  Type: char
  Constraints: must be a single character which may be a line drawing character.
  Default: ''

shortcut_prefix()

A string to print immediately before the hotkey of an item.

  Type: string
  Constraints: must be a string of printable characters (including spaces) or a
               line drawing character optionally surrounded by one or more 
               spaces on one or both sides.
  Default: ''

shortcut_postfix()

A string to print immediately after the hotkey of an item.

  Type: string
  Constraints: must be a string of printable characters (including spaces) or a
               line drawing character optionally surrounded by one or more 
               spaces on one or both sides.
  Default: ''

delimiter()

Print this character between the hotkey and the description in the list of items.

  Type: char
  Constraints: must be a single character which may be a line drawing character.
  Default: ''

label_prefix()

A string to print immediately before the description of an item.

  Type: string
  Constraints: must be a string of printable characters (including spaces) or a
               line drawing character optionally surrounded by one or more 
               spaces on one or both sides.
  Default: ''

label_postfix()

A string to print immediately after the description of an item.

  Type: string
  Constraints: must be a string of printable characters (including spaces) or a
               line drawing character optionally surrounded by one or more 
               spaces on one or both sides.
  Default: ''

title()

The text to use as the title of the menu.

  Type: string
  Constraints: astring of printable characters (including spaces)
  Default: ''

title_style()

Apply these character attributes to the title.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD, UNDERLINE and CLEAR
  Default: ['BOLD']

title_fgcolor()

Apply this foreground color to the title.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

title_bgcolor()

Apply this background color to the title.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

title_align()

Align the text of the title according to this setting. Unless title_fill is set alignment will be ignored.

  Type: string
  Constraints: must be one of LEFT, RIGHT or CENTER
  Default: 'CENTER'

title_fill()

Pad the title with whitespace to fill up the full width of the menu.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

title_frame()

Put a frame around the title.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

title_frame_style()

Apply these character attributes to the frame around the title.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD and CLEAR
  Default: ['REVERSE']

title_frame_fgcolor()

Apply this foreground color to the frame around the title.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

title_frame_bgcolor()

Apply this background color to the frame around the title.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

items()

The list of selectable items. They will be presented in the order given here. Each item consists of a hotkey (given as a single character or a key name), å description (given as a string of printable characters, including spaces) and a reference to a piece of code associated with this item. The description may be an empty string (why would someone want that?) and the code reference may be undefined.

  Type: array of arrays
  Constraints: [[<keyname>, <string>, <code_ref>], ...]
  Default: []

item_style()

Apply these character attributes to each item.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD, UNDERLINE and CLEAR
  Default: ['CLEAR']

item_fgcolor()

Apply this foreground color to each item.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

item_bgcolor()

Apply this background color to each item.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

item_align()

Align the description of each item according to this setting. Unless item_fill is set alignment will be ignored.

  Type: string
  Constraints: must be one of LEFT, RIGHT or CENTER
  Default: 'LEFT'

item_fill()

Pad each item with whitespace to fill up the full width of the menu.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

item_frame()

Put a frame around the list of selectable items.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

item_frame_style()

Apply these character attributes to the frame around the items.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD and CLEAR
  Default: ['CLEAR']

item_frame_fgcolor()

Apply this foreground color to the frame around the items.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

item_frame_bgcolor()

Apply this background color to the frame around the items.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

status()

The text to use in the status line.

  Type: string
  Constraints: astring of printable characters (including spaces)
  Default: ''

status_style()

Apply these character attributes to the status line.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD, UNDERLINE and CLEAR
  Default: ['CLEAR']

status_fgcolor()

Apply this foreground color to the status line.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

status_bgcolor()

Apply this background color to the status line.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

status_align()

Align the text of the status line according to this setting. Unless status_fill is set alignment will be ignored.

  Type: string
  Constraints: must be one of LEFT, RIGHT or CENTER
  Default: 'LEFT'

status_fill()

Pad the status line with whitespace to fill up the full width of the menu.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

status_frame()

Put a frame around the status line.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 0

status_frame_style()

Apply these character attributes to the frame around the status line.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD and CLEAR
  Default: ['CLEAR']

status_frame_fgcolor()

Apply this foreground color to the frame around the status line.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

status_frame_bgcolor()

Apply this background color to the frame around the status line.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

prompt()

The text to use in the prompt.

  Type: string
  Constraints: astring of printable characters (including spaces)
  Default: ''

prompt_style()

Apply these character attributes to the prompt.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD, UNDERLINE and CLEAR
  Default: ['BOLD']

prompt_fgcolor()

Apply this foreground color to the prompt.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

prompt_bgcolor()

Apply this background color to the prompt.

  Type: => string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

prompt_align()

Align the text of the prompt according to this setting. Unless prompt_fill is set alignment will be ignored.

  Type: string
  Constraints: must be one of LEFT, RIGHT or CENTER
  Default: 'LEFT'

prompt_fill()

Pad the prompt with whitespace to fill up the full width of the menu.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 1

prompt_frame()

Put a frame around the prompt.

  Type: boolean
  Constraints: must be one of -, +, 0, 1, NO, N, YES, Y, FALSE, F, TRUE or T
  Default: 0

prompt_frame_style()

Apply these character attributes to the frame around the prompt.

  Type: array
  Constraints: must be one or more of BLINK, REVERSE, BOLD and CLEAR
  Default: ['BOLD']

prompt_frame_fgcolor()

Apply this foreground color to the frame around the prompt.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

prompt_frame_bgcolor()

Apply this background color to the frame around the prompt.

  Type: string
  Constraints: must be one of BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN 
               or WHITE
  Default: ''

Methods

To manipulate the menu a small set of methods is provided.

read_key()

Read a single key from STDIN and return its name. This is done in raw mode.

up($n)

Move the cursor $n lines up. Any surplus that would move it beyond the first line is ignored.

down($n)

Move the cursor $n lines down. Any surplus that would move it beyond the last line is ignored.

right($n)

Move the cursor $n columns to the right. Any surplus that would move it beyond the last column is ignored.

left($n)

Move the cursor $n columns to the left. Any surplus that would move it beyond the first column is ignored.

pos($l, $c)

Move the cursor to the given line ($l) and column ($c). If no valid arguments are given the cursor will be moved to the upper left corner (1,1).

print_title()

Print the title of the menu.

print_items()

Print the list of selectable items.

print_status()

Print the status line.

print_prompt()

Print the prompt.

print_cursor()

Position the cursor after the prompt and print cursor_char if the prompt is visible.

cursor_off()

Turn of the cursor (hide it).

cursor_on()

Turn on the cursor (make it visible again).

clearscreen()

Wipe the entire screen and put the cursor in the upper left corner.

is_up_key($keyname)

Return 1 if the given key is mentioned in up_keys and 0 if it is not.

is_down_key($keyname)

Return 1 if the given key is mentioned in down_keys and 0 if it is not.

is_help_key($keyname)

Return 1 if the given key is mentioned in help_keys and 0 if it is not.

is_exit_key($keyname)

Return 1 if the given key is mentioned in exit_keys and 0 if it is not.

is_selection_key($keyname)

Return 1 if the given key is mentioned in selection_keys and 0 if it is not.

is_shortcut($keyname)

Return the number of the corresponding item if the given key is a shortcut. If the key does not relate to an item 0 is returned.

shortcuts()

List all shortcuts associated with a selectable item.

item_count()

Return the number of selectable items.

move_selection($n)

Move the selection $n entries up (negative value) or down (positive value). If selection_wrap is not enabled this movement will stop at the first or last item.

do_key($keyname)

Perform the action associated with this key. This could be a selection movement or a help invocation or the execution of an item. After this 0 will be returned if nothing was done, 1 for success and undef for exit.

do_item($n)

Execute the code associated with item $n (if it is defined). The number of the current selection is passed to the called routine.

do_help($n)

Invoke help for the given item. The number of the current selection is passed to the called routine.

print_menu()

Print the entire menu.

update_status($status)

Change the value of status and reprint the status line.

update_prompt($prompt)

Change the value of prompt and reprint the prompt.

line_after_menu()

Return the number of the first line after the menu.

Exports

This is a fully object-oriented module. No exports are needed as all publicly available attributes and methods are accessible through the object itself.

NOTES ^

Hotkeys can be specified by using their name. This includes most of the so-called special keys. Their names and corresponding keycodes as used in this module are listed below:

  "HOME"   => "\e[1~"   #Linux console
  "INSERT" => "\e[2~"   #VT100
  "DEL"    => "\e[3~"   #VT100
  "END"    => "\e[4~"   #Linux console
  "PGUP"   => "\e[5~"   #VT100
  "PGDN"   => "\e[6~"   #VT100
  "F1"     => "\e[11~"  #VT100
  "F2"     => "\e[12~"  #VT100
  "F3"     => "\e[13~"  #VT100
  "F4"     => "\e[14~"  #VT100
  "F5"     => "\e[15~"  #VT100
  "F6"     => "\e[17~"  #VT100
  "F7"     => "\e[18~"  #VT100
  "F8"     => "\e[19~"  #VT100
  "F9"     => "\e[20~"  #VT100
  "F10"    => "\e[21~"  #VT100
  "F11"    => "\e[23~"  #VT100
  "F12"    => "\e[24~"  #VT100
  "F1"     => "\e[[A"   #Linux console
  "F2"     => "\e[[B"   #Linux console
  "F3"     => "\e[[C"   #Linux console
  "F4"     => "\e[[D"   #Linux console
  "F5"     => "\e[[E"   #Linux console
  "UP"     => "\e[A"    #VT100
  "DOWN"   => "\e[B"    #VT100
  "RIGHT"  => "\e[C"    #VT100
  "LEFT"   => "\e[D"    #VT100
  "END"    => "\e[F"    #VT100
  "HOME"   => "\e[H"    #VT100
  "UP"     => "\eOA"    #XTerm
  "DOWN"   => "\eOB"    #XTerm
  "RIGHT"  => "\eOC"    #XTerm
  "LEFT"   => "\eOD"    #XTerm
  "END"    => "\eOF"    #XTerm
  "HOME"   => "\eOH"    #XTerm
  "F1"     => "\eOP"    #XTerm
  "F2"     => "\eOQ"    #XTerm
  "F3"     => "\eOR"    #XTerm
  "F4"     => "\eOS"    #XTerm
  "META-a" => "\ea"    
  "META-b" => "\eb"    
  "META-c" => "\ec"    
  "META-d" => "\ed"    
  "META-e" => "\ee"    
  "META-f" => "\ef"    
  "META-g" => "\eg"    
  "META-h" => "\eh"    
  "META-i" => "\ei"    
  "META-j" => "\ej"    
  "META-k" => "\ek"    
  "META-l" => "\el"    
  "META-m" => "\em"    
  "META-n" => "\en"    
  "META-o" => "\eo"    
  "META-p" => "\ep"    
  "META-q" => "\eq"    
  "META-r" => "\er"    
  "META-s" => "\es"    
  "META-t" => "\et"    
  "META-u" => "\eu"    
  "META-v" => "\ev"    
  "META-w" => "\ew"    
  "META-x" => "\ex"    
  "META-y" => "\ey"    
  "META-z" => "\ez"    
  "CTRL-a" => "\x01"   
  "CTRL-b" => "\x02"   
  "CTRL-c" => "\x03"   
  "CTRL-d" => "\x04"   
  "CTRL-e" => "\x05"   
  "CTRL-f" => "\x06"   
  "CTRL-g" => "\x07"   
  "CTRL-h" => "\x08"   
  "TAB"    => "\x09"   
  "ENTER"  => "\x0A"   
  "CTRL-k" => "\x0B"   
  "CTRL-l" => "\x0C"   
  "CTRL-m" => "\x0D"   
  "CTRL-n" => "\x0E"   
  "CTRL-o" => "\x0F"   
  "CTRL-p" => "\x10"   
  "CTRL-q" => "\x11"   
  "CTRL-r" => "\x12"   
  "CTRL-s" => "\x13"   
  "CTRL-t" => "\x14"   
  "CTRL-u" => "\x15"   
  "CTRL-v" => "\x16"   
  "CTRL-w" => "\x17"   
  "CTRL-x" => "\x18"   
  "CTRL-y" => "\x19"   
  "CTRL-z" => "\x1A"   
  "SPACE"  => "\x20"   
  "BS"     => "\x7F"   

Colors can be specified by using their common ANSI names:

  BLACK
  RED
  GREEN
  YELLOW
  BLUE
  MAGENTA
  CYAN
  WHITE

Character attributes can be specified by using these ANSI names:

  CLEAR
  BOLD
  UNDERLINE
  BLINK
  REVERSE

Some attributes can be assigned line drawing characters. The names of these characters are are:

  HOR (Horizontal line)
  VER (Vertical line)
  ULC (Upper Left Corner)
  URC (Upper Right Corner)
  LRC (Lower Right Corner)
  LLC (Lower Left Corner)
  LTE (Left T)
  RTE (Right T)
  TTE (Top T)
  BTE (Bottom T)
  CTE (Crossing Ts)

DIAGNOSTICS ^

All errors are reported through the Carp module. These are mainly encountered when using an illegal value for an attribute or method. When that happens a carp warning is generated and the given value is just ignored. A croak message is generated when calling non-existent attributes or methods.

Following is a list of all diagnostic messages generated by Term::ANSIMenu. They should be self-explaining.

BUGS ^

Well, this is version 0.01, so there must be some. But I haven't seen them yet. If you do find a bug or just like to see a feature added I'd appreciate it if you'd let me know.

FILES ^

This module depends on the standard Carp module to blame your script if something goes wrong `;-)

It also depends on Term::ReadKey to read input from the keyboard.

A terminal capable of interpreting ANSI sequences might help too...

SEE ALSO ^

Carp

Term::ReadKey

AUTHOR ^

J.A. de Vries <j.a.devries@dto.tudelft.nl>

COPYRIGHT ^

Copyright (c) 2003, Jadev.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

syntax highlighting: