CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
command line menu help

 



logan
New User

Oct 16, 2012, 3:05 PM

Post #1 of 2 (829 views)
command line menu help Can't Post


Code
package CmdLine; 

use Term::Menu;

sub menufy {
my $menu=new Term::Menu;
START:
while (1) {
my $answer=$menu->menu(
Add => ["Add an entry", 'a'],
Exit => ["Exit", 'e']
);
if ($answer eq 'Add') {
print "Adding...\n";
}
elsif ($answer eq 'Exit') {
goto START;
}
else {
print "Error adding entry\n";
}
}
}
return 1;


How to make it so that when 'e' is pressed it exits?


FishMonger
Veteran / Moderator

Oct 16, 2012, 4:10 PM

Post #2 of 2 (826 views)
Re: [logan] command line menu help [In reply to] Can't Post


Code
elsif ($answer eq 'Exit') {  
exit;
}


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives