I'm looking to create an interactive console application with Perl. What I'm really looking for is something similar to a less screen, but where a user could input commands to perform certain functions, and where output could continually be updated on their screen. For instance, they might want to filter the output by pressing "f" and typing in a regex. They might wish to manipulate or filter the output in other ways.

A simple example would be printing information to the screen, and updating it every 5 seconds. I've seen other users emulated this by clearing the console and re-printing the information. What I don't like about this, is that all it does is scroll x amount of blank lines down and re-print the information. So that if you looked at the command prompt history, you would see the information printed and a bunch of blank lines many, many times.

If possible I want it to be like less, where it opens up an interactive screen, yet once the user quits the command prompt history does not show anything. In other words the information stayed exclusively in the less session, and there was no trace of it once the user quit the program. Please let me know if there is a way to do this, or even a module.

Thanks!


In reply to Interactive "Less Screen" Possible? by bigbot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.