in reply to Re: Disable Control +C
in thread Disable Control +C
Here is my code:
#!/usr/bin/perl use 5.010; use warnings; use strict; printf (" #############################\n"); printf (" ########## TEST MENU ########\n"); printf (" #############################\n"); sleep(2); $SIG{INT} = 'IGNORE'; while(1) { printf ("WHAT DO YOU WANT TO DO\n"); printf (" * * * * *\n"); printf (" 1- Option\n"); printf (" 2- Option\n"); printf (" 5-Exit \n"); printf (" * * * * *\n"); my $choose = <STDIN>; chomp($choose); if($choose eq 1) { option->client; } elsif($choose eq 2) { option2(); } elsif($choose eq 5) { printf("Good Bye :-)\n"); sleep(2); exit(1); }; };
When you hit control +c within the program it sends errors to the screen...it prohibits control +c to kill the program. I have to choose option 5 to exit which is what I want...now to avoid the errors? Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Disable Control +C
by Athanasius (Archbishop) on Mar 13, 2013 at 02:30 UTC | |
by PilotinControl (Pilgrim) on Mar 13, 2013 at 07:13 UTC |
In Section
Seekers of Perl Wisdom