artist has asked for the wisdom of the Perl Monks concerning the following question:
Your input will be valuable. Here is a sample program for curses, Here is the code if anyone want to give it a shot.
#!/usr/local/bin/perl use strict; use Curses; &initialize(); &routine(); &finalize(); sub routine { while(1){ while ((my $key = getch()) ne ERR) { if($key eq 'q'){ &clear_screen; done("See you again!"); } if($key eq 'h'){ &clear_screen; print_me("Hello"); } if($key eq 'w'){ &clear_screen; print_me("World"); } } } } sub initialize{ Curses::initscr(); Curses::noecho(); Curses::cbreak(); Curses::nodelay(1); } sub finalize{ Curses::endwin(); exit(0); } sub print_me { my $string = shift; Curses::move(10,20); Curses::addstr($string); Curses::move(0,0); } sub clear_screen { Curses::move(10,20); Curses::addstr(" "x70); } sub done { endwin(); print "@_\n"; exit; }
Thanks
Artist
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Application using Curses
by derby (Abbot) on Jul 29, 2003 at 15:07 UTC |