Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

print from curses

by morgon (Curate)
on Feb 01, 2017 at 00:36 UTC ( #1180729=perlquestion: print w/replies, xml ) Need Help??
morgon has asked for the wisdom of the Perl Monks concerning the following question:


is it possible to print from a curses-program in such a way that the output is retained after the script ends?

To illustrate:

use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window'); my $listbox = $win->add( 'mylistbox', 'Listbox', -values => [1, 2, 3], -labels => { 1 => 'One', 2 => 'Two', 3 => 'Three' }, ); $listbox->onChange( sub { my $sel = $listbox->get; endwin; print $sel; exit; } ); $cui->set_binding( sub { exit(0); } , "\cC"); $cui->mainloop;
So my thinking was that calling endwin in the handler would end all the curses-magic and you could print stuff that curses would no longer overwrite, but unfortunately that does not work.

Does anyone know how to do this (I am a complete newbie with curses I am afraid).

Many thanks!

Replies are listed 'Best First'.
Re: print from curses
by Anonymous Monk on Feb 01, 2017 at 02:44 UTC
      clear_on_exit is documented (I don't know why you grep through the source) and it should be off by default.

      . I have already tried to turn it off explicitly but it does not help with my problem.

      should have mentioned that in my question, Sorry.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1180729]
Approved by beech
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-06-25 06:34 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.