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

soaplite subroutine parameters

Expand Messages
  • H G <zouko@rocketmail.com>
    I m new to soaplite and I have a basic question about the interaction between servers and clients using it. I noticed in some code that when you call a
    Message 1 of 3 , Dec 26, 2002
    • 0 Attachment
      I'm new to soaplite and I have a basic question about the interaction between
      servers and clients using it.

      I noticed in some code that when you call a function from a client and pass a
      parameter to it, the subroutine will expect two parameters. Eg.:

      Client:
      $soap->func($xml);

      Server: inside sub func

      my ($class, $xml) = _@;

      Another example is:

      $soap->add($var1, $var2);

      Server:
      sub add { $_[1] + $_[2]; }

      Will the first variable ($class) contain some hidden variables or is it used for
      something else? And in the second example what does $_[0] contain?

      Thanks.

      Haitham Gasim
    • Shihe Wang
      Hi, The first parameter is the method name, i.e., in your 1st example $class = func , in your 2nd example $_[0] should be add . As it is no practical use in
      Message 2 of 3 , Dec 26, 2002
      • 0 Attachment

        Hi,

        The first parameter is the method name, i.e., in your 1st example $class = 'func', in your 2nd example $_[0] should be 'add'. As it is no practical use in server code, usually use 'shift' to remove it.

        Shawn Wang 

         "H G <zouko@...>" <zouko@...> wrote:

        I'm new to soaplite and I have a basic question about the interaction between
        servers and clients using it.

        I noticed in some code that when you call a function from a client and pass a
        parameter to it, the subroutine will expect two parameters. Eg.:

        Client:
        $soap->func($xml);

        Server: inside sub func

        my ($class, $xml) = _@;

        Another example is:

        $soap->add($var1, $var2);

        Server:
        sub add      { $_[1] + $_[2]; }

        Will the first variable ($class) contain some hidden variables or is it used for
        something else? And in the second example what does $_[0] contain?

        Thanks.

        Haitham Gasim


        To unsubscribe from this group, send an email to:
        soaplite-unsubscribe@yahoogroups.com



        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



        Do you Yahoo!?
        Yahoo! Mail Plus - Powerful. Affordable. Sign up now

      • Duncan Cameron
        ... Try printing its value! Your server functions are always invoked as methods using Perl s standard O-O idiom. The $class variable will either be the
        Message 3 of 3 , Dec 27, 2002
        • 0 Attachment
          On 2002-12-26 H G <zouko wrote:
          >I'm new to soaplite and I have a basic question about the interaction between
          >servers and clients using it.
          >
          >I noticed in some code that when you call a function from a client and pass a
          >parameter to it, the subroutine will expect two parameters. Eg.:
          >
          >Client:
          >$soap->func($xml);
          >
          >Server: inside sub func
          >
          >my ($class, $xml) = _@;
          >
          >Another example is:
          >
          >$soap->add($var1, $var2);
          >
          >Server:
          >sub add { $_[1] + $_[2]; }
          >
          >Will the first variable ($class) contain some hidden variables or is it used for
          >something else? And in the second example what does $_[0] contain?
          >
          Try printing its value! Your server 'functions' are always invoked
          as 'methods' using Perl's standard O-O idiom.

          The $class variable will either be the class name (you don't
          indicate what your class actually is) or be an instance of the class
          if you are using objects by reference.
          See the iterator.pl and the PersistentIterator.pm files in
          the examples directory for how that first parameter might be used.

          Regards,
          Duncan Cameron
        Your message has been successfully submitted and would be delivered to recipients shortly.