in reply to Re^3: Eval thread and restart it.
in thread Eval thread and restart it.
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Eval thread and restart it.
by ikegami (Patriarch) on Apr 19, 2010 at 20:40 UTC | |
|
Re^5: Eval thread and restart it.
by BrowserUk (Patriarch) on Apr 19, 2010 at 21:37 UTC |