Loading ...
Sorry, an error occurred while loading the content.

4791Re: [soaplite] SOAP::Lite timeout issue?

Expand Messages
  • Mark Fuller
    Jul 12, 2005
    • 0 Attachment
      --- Dominick Meglio <dmeglio@...> wrote:

      > My question is, how do I get the connect attempt to
      > stop if my
      > specified timeout has elapsed, and simply allow me
      > to detect the error
      > condition and allow my program to continue on?

      I don't know what the correct answer is regarding
      S::L's handling of client connection timeouts. But, as
      a workaround, you should be able to set an alarm
      within your eval and trap it. You need a signal
      handler for the alarm. I had an example of doing this
      with something else. I'd have to look for it. (It is a
      little trickier than it sounds because there's a race
      condition between the inner alarm and the outer eval.
      Something like that.)

      As far as eval'ing to trap fatal errors. I think
      that's relatively common. I know I had to do it with
      ssh::sftp. I didn't think it was too cumbersome. I had
      to accomodate for what may be multiple errors within
      an eval and that $@ will have the last error (which
      may not be as informative as earlier errors). I
      handled this with a signal handler to capture every
      warning event. I added each warning message to an
      array each time the signal handler was invoked. In the
      end, I had an array of messages (if multiple errors

      my @warnings;

      $SIG{"__WARN__"} = sub { $warnings[$#warnings + 1] =
      $_[0]; };

      eval {$my_result = $object->function(".");};

      $SIG{"__WARN__"} = "DEFAULT";

      if ($#warnings > -1 or (!defined($pwd) or $pwd eq "")
      ) {
      # treat it as an error, display each row of @array

      Maybe that would be useful to you?


      Yahoo! Mail for Mobile
      Take Yahoo! Mail with you! Check email on your mobile phone.
    • Show all 2 messages in this topic