Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Interactive program

by oldwarrior32 (Sexton)
on Jun 25, 2012 at 23:42 UTC ( #978304=perlquestion: print w/ replies, xml ) Need Help??
oldwarrior32 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks! I am asking for your infinite wisdom again.

I am working in a program where the user selects some options. Based in the selections he gets some output and based in that output he enters some data, and based in the data another output appears and he can select an option and so on...

What I am doing is basically a do-while loop. At the end of the loop, some if-else conditions are processed, so the loop executes again or another do-while loop is executed.

Do you know of some procedure or something like a pragma to build interactive CLI programms?

Any help is appreciated!

Comment on Interactive program
Re: Interactive program
by sauoq (Abbot) on Jun 25, 2012 at 23:57 UTC
    Do you know of some procedure or something like a pragma to build interactive CLI programms?

    By "pragma" I wonder if you don't just mean a module...

    See Term::ReadLine maybe.

    -sauoq
    "My two cents aren't worth a dime.";
Re: Interactive program
by davido (Archbishop) on Jun 26, 2012 at 00:07 UTC

    Maybe it's late in the day for me, but I'm having a little difficulty parsing your question. Most of what you're talking about is just "programming", so I think you're asking about good ways to prompt for user input.

    For taking user input, I kind of like IO::Prompt::Tiny; it's simple to use, and is based on the prompt() function built into ExtUtils::MakeMaker. The one caveat is that it has a dependency on Capture::Tiny, which is also a really convenient module, but has a few FAILS on Win32 (and more PASSes). That may or may not be an issue for you.

    use IO::Prompt::Tiny qw( prompt ); # Prompt with a default of vanilla. my $input = prompt( 'Please enter your ice cream preference', 'vanilla +' ); print "So....you like $input ice cream. Freud would love this revelat +ion.\n";

    Dave

Re: Interactive program
by ~~David~~ (Hermit) on Jun 26, 2012 at 16:53 UTC
    To me, it sounds like you are looking for an event driven interactive program with option selection, etc. I usually use a GUI for these type of needs, and I always use Tk.
Re: Interactive program
by oldwarrior32 (Sexton) on Jun 26, 2012 at 23:48 UTC

    I was just looking for some "good practices" making interactive programming. Thanks for your help.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://978304]
Approved by muba
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-07-10 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (209 votes), past polls