0

I use Term::Screen to put string in xterm.

$scr->at(2,0)->puts("this is some stuff");

But I would like to capture, get the 2nd line (offset 0 until eol), something like that:

$scr->at(2,0)->gets();

Or how can an escape sequence do that?

Thanks for your help!

user1334149
  • 161
  • 1
  • 7
  • 1
    The docs on `Term::Screen` say: "This is not a replacement for Curses -- it has no memory". So you maybe want `Curses` instead? – Slaven Rezic Sep 06 '13 at 14:05

1 Answers1

0

Not sure if I understand you correctly. From your sample code I take: You want to print on row 2, then put the cursor on the beginning of the very same row and get the user input until EOL? In any case, I'd recommend to use Term::Screen::ReadLine, not Term::Screen. If I understood you right, I guess it should be along the lines of the following:

#!/usr/bin/perl

use strict;
use Term::Screen::ReadLine;

my $t = Term::Screen::ReadLine->new;

$t->clrscr;
#$t->at(2, 0)->puts("this is some stuff");
my $in = $t->readline(ROW => 2, COL => 0, OVERWRITE => 0, LINE => "this is some stuff");

$t->at(3, 0)->puts("You wrote '$in'");
ukautz
  • 2,193
  • 1
  • 13
  • 7