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

Problem using "use" & "require" in my dispatched Package

Expand Messages
  • ritun2000@yahoo.com
    Hi everyone! I am using SOAP Lite for Perl on Linux and have written a small server which is dispatching a Package named USER.pm.This package has many use &
    Message 1 of 4 , Nov 29, 2001
    • 0 Attachment
      Hi everyone!

      I am using SOAP Lite for Perl on Linux and have written a small
      server which is dispatching a Package named USER.pm.This package
      has many "use" & "require" statements for various modules
      like Net::LDAP etc.When I run my client script, the methods within
      USER.pm do not return anything.Further, I do not get any errors too.
      Looks like its a problem with the BEGIN {}.I tried changing all "use"
      to "require" and vice-versa in USER.pm, but in vain.

      Can someone help me on this..


      Regards,
      Ritu
    • Paul Kulchenko
      Hi, Ritu! Section from User Guide may help you see several options you have: [http://guide.soaplite.com/#service dispatch (different services on one server)]
      Message 2 of 4 , Nov 29, 2001
      • 0 Attachment
        Hi, Ritu!

        Section from User Guide may help you see several options you have:
        [http://guide.soaplite.com/#service dispatch (different services on
        one server)]

        SECURITY section in SOAP::Lite documentation explains issues you may
        have with use/require and how to deal with that.

        > Further, I do not get any errors too.
        I don't know what that means. Either code is successful or it'll die
        and fault will be propagated on client side. If 'use' or 'require'
        fails you can check it on client side with:

        my $client = SOAP::Lite->proxy.....
        my $response = $client->mymethod;
        die $response->faultstring if $response->fault;
        print $response->result;

        or something similar. Hope it helps.

        Best wishes, Paul.

        --- ritun2000@... wrote:
        > Hi everyone!
        >
        > I am using SOAP Lite for Perl on Linux and have written a small
        >
        > server which is dispatching a Package named USER.pm.This package
        > has many "use" & "require" statements for various modules
        > like Net::LDAP etc.When I run my client script, the methods within
        > USER.pm do not return anything.Further, I do not get any errors
        > too.
        > Looks like its a problem with the BEGIN {}.I tried changing all
        > "use"
        > to "require" and vice-versa in USER.pm, but in vain.
        >
        > Can someone help me on this..
        >
        >
        > Regards,
        > Ritu
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
        http://geocities.yahoo.com/ps/info1
      • 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 3 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 4 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.