Skip Menu |

This queue is for tickets about the Curses CPAN distribution.

Report information
The Basics
Id: 65818
Status: open
Priority: 0/
Queue: Curses

People
Owner: Nobody in particular
Requestors: andrew.pennebaker [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: echo() has no effect for Mac OS X
Try a little experiment: perl -e "use Curses qw(noecho echo); noecho; echo;" When I run this, my terminal does NOT restore its input echoing ability. I have to quit Terminal.app in order to see what I type. Specs: Curses 1.28 Perl 5.10.0 Mac OS X 10.6.6
On Thu Feb 17 04:31:34 2011, mcandre wrote: Show quoted text
> Try a little experiment: > > perl -e "use Curses qw(noecho echo); noecho; echo;
When I do it, I get a segmentation fault because I did not initialize Curses with initscr(). If I do initscr() (which maybe your version of curses is doing for you implicitly), then I get the behavior you describe (regardless of whether I do the noecho; echo in between), and I expect it because initscr() turns off the terminal echo. I have to do endwin() to restore the terminal. echo() and noecho() are supposed to control only the echoing that curses does, meaning they could not possibly affect the terminal after the program exits. Curses keeps the terminal's own echoing turned off all the time so that it can control echoes itself. And that's one of the many reasons you have to do the endwin() before exiting a Curses program. At least _I_ do.
From: andrew.pennebaker [...] gmail.com
Maybe echo() and noecho() aren't supposed to effect terminal behavior outside Perl, but in my experience they do. 1 When Curses.pm is used, and after Perl exits, text does not appear on the screen. 2 Before Curses.pm is used, stty returns icanon echo. 3 After Curses.pm is used, stty returns -canon -echo. 4 According to stty's man page, -canon and -echo prevent text from appearing on the screen. 5 Now, I add `stty icanon echo`to my scripts. 6 Now, before and after Curses.pm is used, stty returns icanon echo. 7 Now, before and after Curses.pm is used, text is echoed on the terminal as it normally does.
From: andrew.pennebaker [...] gmail.com
I think the problem is not Curses, but Games::Roguelike::Console, which uses Curses. The rogue wrapper adds a custom SIGINT handler to try to restore the terminal, call endwin(), etc., but it does so poorly.