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

silent failures

Expand Messages
  • Ian Kallen
    I ve observed that if XML::Parser (or something it depends) is not properly installed, SOAP::Lite can fail silently. Unfortunately I don t have a simple
    Message 1 of 4 , Nov 29, 2001
    • 0 Attachment
      I've observed that if XML::Parser (or something it depends) is not
      properly installed, SOAP::Lite can fail silently. Unfortunately I don't
      have a simple example to illustrate but I'm looking very suspiciously at
      this method

      sub xmlparser {
      my $self = shift;
      return eval { $SOAP::Constants::DO_NOT_USE_XML_PARSER ? undef : do
      {require XML::Parser; XML::Parser->new} } ||
      eval { require XML::Parser::Lite; XML::Parser::Lite->new } ||
      die "XML::Parser is not @{[$SOAP::Constants::DO_NOT_USE_XML_PARSER ?
      'used' : 'available']} and ", $@;
      }

      I haven't verified the validity or lack thereof of this construct but I'm
      suspicious, I don't know what reason there is to _not_ use a more
      conventional construct such as

      eval {
      # do something that might fail
      };
      if ($@) {
      # handle error
      }

      At a minimum, it's easier on the reader. I ran into this problem when a
      co-worker goofed up moving around some libraries,
      {arch}/auto/XML/Parser/Expat/Expat.so didn't make when things got moved
      and I managed to make the SOAP server cgi go into a spin and consume all
      CPU resources until apache finally timed it out!

      --
      Ian Kallen <spidaman@...> | AIM: iankallen
    • Paul Kulchenko
      Hi, Ian! ... Shouldn t happen. XML::Parser is used if installed (unless DO_NOT_USE_XML_PARSER is true), then XML::Parser::Lite (which is included with
      Message 2 of 4 , Nov 30, 2001
      • 0 Attachment
        Hi, Ian!

        --- Ian Kallen <spidaman@...> wrote:
        > I've observed that if XML::Parser (or something it depends) is not
        > properly installed, SOAP::Lite can fail silently. Unfortunately I
        Shouldn't happen. XML::Parser is used if installed (unless
        DO_NOT_USE_XML_PARSER is true), then XML::Parser::Lite (which is
        included with SOAP::Lite, so always available) and only then
        SOAP::Lite will die with diagnostics. Could it be something more low
        level (because of unavailability of Expat.so)?

        > I haven't verified the validity or lack thereof of this construct
        > but I'm
        > suspicious, I don't know what reason there is to _not_ use a more
        > conventional construct such as
        >
        > eval {
        > # do something that might fail
        > };
        > if ($@) {
        > # handle error
        > }
        >
        > At a minimum, it's easier on the reader. I ran into this problem
        Because straightforward:

        return eval {} || # XML::Parser
        eval {} || # XML::Parser::Lite
        die "...";

        becomes

        my $parser;
        unless ($DO_NOT_USE...) {
        eval {
        require XML::Parser; $parser = XML::Parser->new;
        };
        return $parser unless $@;
        }
        eval {
        require XML::Parser::Lite; $parser = XML::Parser::Lite->new;
        }
        return $parser unless $@;
        die "...";

        Wouldn't say it's easy on reader, but it's a matter of taste ;). Mine
        is spoiled ;).

        > and I managed to make the SOAP server cgi go into a spin and
        > consume all CPU resources until apache finally timed it out!
        As you see, there is no loops or anything of that kind. I can't image
        what could be the reason for consuming resources. Any ideas?

        Best wishes, Paul.

        __________________________________________________
        Do You Yahoo!?
        Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
        http://geocities.yahoo.com/ps/info1
      Your message has been successfully submitted and would be delivered to recipients shortly.