Dear Monks,
I have to design and code an application using
curses in Perl.
I have file with data in various fields.I need following functionalities.
- Able to read the given file.
- Simple String Search in the file for data in various fields and display resulting
data.
- Line/Page/Horizontal Scroll Forward/Backward.
- Minimum User Input required for searching, scrolling etc..
- Regex searches if possible.
Now I haven't designed an application like this before so I may miss
other important features. But this is what I can think of currently.
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;
}
Your help would be useful in any direction, including suggestions and
examples.
Thanks
Artist
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.