in reply to how to prevent perl script from terminating

You can use "eval" around the code..
while (1) { $wrote = undef; eval { $wrote = write_partial($ssl, $written, $to_write, $$data_ref) +; 1; } or do { print "WRITE PARTIAL FAILED L: \"" . __LINE__ . "\"\n"; sle +ep 3; next; } if(defined $wrote) { print "WROTE: \"$wrote\". LAST L: \"" . __LINE__ . "\"\n"; last; } else { print "DO NOT KNOW HOW I GOT HERE WROTE: \"$wrote\". LAST L: + \"" . __LINE__ . "\"\n"; } } #EO WHILE
Joe

Replies are listed 'Best First'.
Re^2: how to prevent perl script from terminating
by kamrul (Acolyte) on May 20, 2015 at 18:01 UTC
    Hi thanks for your reply. Im going to try that. One small question. Can you please explain why you are using the loop around the code ?

    Thanks in advanced ..

      The loop will keep trying the write_partial until it succeeds.

      Dum Spiro Spero
      Just tried like the below :
      eval{ $wrote = write_partial($ssl, $written, $to_write, $$data_ref); }; print "Write error $@" if $@;
      But no luck! the script is terminating showing no error. Is there anything else I can try ?