Do you have any other suggestion on what I'm am trying to do. Is there another way but eval?
Here is the code I have:#!/usr/bin/perl use lib "/nss/nfx/thread_libs/lib/"; use threads; my $thr = threads->create( sub { while (1) { eval { while (1) { print "Starting Main function again.\n"; worker(); } }; if ($@) { print "Error Occured: <$@>.\n"; $@=(); sleep (5); } } } ); sub worker { open FILE_OUT, "> /root/xyz" or die "Can't open file: $!"; } while (1) { sleep 500; }
In reply to Re^4: Eval thread and restart it.
by mr_p
in thread Eval thread and restart it.
by mr_p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |