Hans Oesterholt > Term-Screen-ReadLine-0.35 > Term::Screen::ReadLine

Download:
Term-Screen-ReadLine-0.35.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.35   Source   Latest Release: Term-Screen-ReadLine-0.38

NAME ^

Term::Screen::ReadLine - Term::Screen extended with ReadLine

SYNOPSIS ^

  use lib "./blib/lib";

  use Term::Screen::ReadLine;

  $scr = new Term::Screen::ReadLine;

  $scr->clrscr();
  $a=$scr->getch();
  print $a," ",length $a," ",ord($a),"\n";
  $scr->two_esc;
  $a=$scr->getch();
  print $a," ",length $a," ",ord($a),"\n";
  $scr->one_esc;


  $scr->clrscr();
  $scr->at(4,4)->puts("input? ");
  $line=$scr->readline(ROW => 4, COL => 12);
  $line=$scr->readline(ROW => 5, COL => 12, DISPLAYLEN => 20);
  $scr->at(10,4)->puts($line);
  $scr->two_esc;
  $line=$scr->readline(ROW => 6, COL => 12, DISPLAYLEN => 20, ONLYVALID => "[ieIE]+", CONVERT => "up");

  print "\n";
  print $scr->lastkey(),"\n";

  $r=$scr->getch();
  print $r,ord($r),"\n";
  $r=ord($r);
  print $r,"\n";
  if ($r eq 13) { 
    print "aja!\n";
  }

exit;

DESCRIPTION ^

This module extends Term::Screen with a readline() function. It also makes it possible to use a *single* Esc to escape instead of the Term::Screen double Esc.

USAGE ^

readline()

  readline(
    ROW         => 0,
    COL         => 0,
    LEN         => 40,
    DISPLAYLEN  => undef,
    LINE        => "",
    ONLYVALID   => undef,
    CONVERT     => undef,
    PASSWORD    => undef,
  )

Parameters

ROW,COL

'at(ROW,COL) readline()...'.

LEN

The maximum length of the line to read.

DISPLAYLEN

The maximum length of the displayed field. The display will scroll if DISPLAYLEN is exceeded.

EXITS

Explained below.

LINE

A default value for readline to use.

ONLYVALID

A regex to validate the input.

CONVERT

"up" or "lo" for uppercase or lowercase. Empty ("") if not used. Note: conversion will take place after validation.

PASSWORD

Display stars ('*') instead of what is being typed in.

Return value

Returns The inputted line.

Notes

last_key()

returns the last key pressed, that made the readline function return.

one_esc()

Makes it possible to press only one time Esc to make readline return. This is the default for Term::Screen::ReadLine.

two_esc()

Revert back to the standard Term::Screen behaviour for the Esc key.

AUTHOR ^

Hans Dijkema <hdnews _AT_ gawab _DOT_ com>

syntax highlighting: