On Sep 14, 2:52 am, soorajspadmanab...@gmail.com (Sooraj S) wrote:
> Hi,
>
> My perl script internally calls some other scripts. The execution time
> of the script is 5 min. I dont want any user to stop or suspend the
> execution. ie I want my script to ignore the (ctrl+z) and (Ctlr+c)
>
> By adding the following line to my script i was able to prevent user
> from stopping my script using (Ctlr+c)
> $SIG{INT} = 'IGNORE';
>
> Is there any way to handle Ctlr+z ?

Ctrl+z normally generates a  SIGTSTP on Unix so
if $^O is Unix based, you should be able to use:

{
    # code block you don't want to be interrupted
   local $SIG{TSTP} = 'IGNORE';
   local $SIG{INT}     = 'IGNORE';
   ...
}
# resume code that is ok to interrupt

[ You could also set both signals at once:
   local @SIG{INT,TSTP} = ('IGNORE') x 2;  ]

On the other hand if $^O is Win32 based, you
probably want to take a look at Win32::API.

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to