Matthias Meyer wrote: > Hi group, > > I try to catch a signal, write out some statistics about my running > perl program and continue afterwards with the program. > > use strict; > no utf8; > use MyProgram::Lib; > use Encode; > use Socket; > use File::Path; > use File::Find; > use Getopt::Std; > die("MyProgram::Lib->new failed\n") if ( !(my $init = MyProgram::Lib->init) ); > $SIG{ILL} = \&write_status; > : > sub write_status > { > my $sigName = shift; > > print( STDERR "Signal ILL catched" ); > return; > } > Within bash I send the signal with "kill -4 <procID>" > Unfortunately my program die after catching the signal. > Without the print it dies too. > Also within debugger (perl -d:ptkdb) it dies after the return statement. > > Is it possible to interrupt a perl program and continue afterwards? > > Thanks > Matthias
What OS? Normally a program continues but if it is waiting or sleeping, it continues after the command. You have to redo the command until it terminates correctly. Example: waiting for a child process: my $child_pid = 0; WAIT_BLOCK: { $child_pid = wait(); redo WAIT_BLOCK if $child_pid == 0 || $child_pid < -1; } -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/