http://qs1969.pair.com?node_id=157443

Tardis has asked for the wisdom of the Perl Monks concerning the following question:

Hi folks,

I'm looking at soon(ish) writing an application that will have (among other GUI's) a plain old text console option. I was wondering what experiences people have had, and what they could recommend.

I know about Curses::UI and plain old Curses, though I haven't experimented with either yet. I suspect that making an application from scratch using just Curses would be too hard.

Any other options I should be aware of?

Replies are listed 'Best First'.
Re: Modules for console applications
by stefan k (Curate) on Apr 08, 2002 at 14:37 UTC
    Hi,
    first of all I'd like to point out that using "just Curses" ain't too bad because it is very well documented: all docs come as manpages with the distribution. OK, this is the C API but man Curses (which is the perl documentation) tells you how to read them for perl.

    Then you might be interested in reading the sources of vshnu which is written in perl and uses Term::Screen for the display. Or take a look at this and this thread.

    I've been into curses in C/C++ in the last weeks and besides the usual C-preprocesser screws and the fact that not all terminals work as well as good ol' xterm it's been easy and fun.

    Regards... Stefan
    you begin bashing the string with a +42 regexp of confusion

      Hi,
      I think you should also give a look to Term::Slang.
      The Slang library is supposed to be easier to use and more portable than (n)curses.
      -- 
      perl -l -e "eval pack('h*','072796e647028222d2d202a0e49636f6c61637022292b3');"
      
Re: Modules for console applications
by strfry() (Monk) on Apr 08, 2002 at 17:23 UTC
    Curses is a really fun module to use, although like anything it can bite you if you're not careful. Speaking of which, here is a concise and straightforward example of using the Curses module although as the author notes, he assumes a bit about the terminal size. And not only is it a good working example, it's funny, too. (:

    Also if you care to deobfuscate it, this node is also rather edumacational.
    I'd give an example myself, but I'm at work right now ):

    strfry()
Re: Modules for console applications
by {NULE} (Hermit) on Apr 09, 2002 at 01:15 UTC
    Hi Tardis,

    No one has mentioned Curses::Widgets yet and it is a limited - though darn easy to use module. My Curses Chatterbox Client uses it (though the client itself is out of commission until PM.org stabilizes a bit). It behaves in a way that is not terribly unlike Tk and other GUIs and some clever code modularization should make your task fairly easy.

    By the way, someone mentioned that Curses documentation is easy to find. I disagree - I've googled until I was blue in the face and the closest I ever came was RMS's tutorial for python. I think the documentation is rotten and virtually incomprehensible - but don't let that stop you!

    Good luck, {NULE}
    --
    http://www.nule.org