PrimeLord has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w use strict; sub main_block { my $username = getlogin; my $ppid = getppid; my $result = generate_menu($username); until ($result == 1 || $result == 2) { print "Invalid option.\n"; sleep 2; $result = generate_menu($username); } user_choice($result, $ppid); } sub generate_menu { my $username = shift; system("clear"); print "Welcome $username\n\n"; print "Please chose from the following options:\n"; print "1) Establish PPP Session\n"; print "2) Logoff\n"; print "------------------------\n"; print "Choice: "; chomp (my $result = <STDIN>); return $result; } sub user_choice { my ($result, $ppid) = @_; if ($result == 1) { print "\nServer to connect to: "; chomp (my $server = <STDIN>); ppp_connect($server); } else { kill 9 => $ppid; } } sub ppp_connect { my $server = shift; system("clear"); system("ppp -direct $server"); main_block; } $SIG{INT} = 'IGNORE'; $SIG{TSTP} = 'IGNORE'; main_block;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shell Menu Code Review
by sauoq (Abbot) on Jul 25, 2002 at 19:08 UTC | |
|
Re: Shell Menu Code Review
by Chmrr (Vicar) on Jul 25, 2002 at 19:14 UTC | |
by PrimeLord (Pilgrim) on Jul 25, 2002 at 19:43 UTC | |
|
Re: Shell Menu Code Review
by hossman (Prior) on Jul 25, 2002 at 19:21 UTC | |
by softworkz (Monk) on Jul 25, 2002 at 19:42 UTC | |
by PrimeLord (Pilgrim) on Jul 25, 2002 at 19:48 UTC | |
|
Re: Shell Menu Code Review
by greenFox (Vicar) on Jul 26, 2002 at 02:23 UTC | |
|
Re: Shell Menu Code Review
by Sifmole (Chaplain) on Jul 26, 2002 at 11:35 UTC |