#!/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 = ); return $result; } sub user_choice { my ($result, $ppid) = @_; if ($result == 1) { print "\nServer to connect to: "; chomp (my $server = ); 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;