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

Re: [soaplite] Remote Object Access

Expand Messages
  • Paul Kulchenko
    Hi, Michael! inlined. ... Actually it does. see shift there? It gets first parameter (object) and accesses _temperature field of it. sub as_celsius { return
    Message 1 of 2 , Apr 11, 2001
    • 0 Attachment
      Hi, Michael!

      inlined.

      --- mbrutsch@... wrote:
      > I am trying to access an existing class using a technique similar
      > to
      > the 'Temperature' example in the Guide. In all of my existing
      > classes, the methods expect the first parameter to be the class
      > (i.e.
      > they all start out "my $self = shift;") However, in your example,
      > the
      > 'as_celsius' method does not do this, while the 'c2f' method
      > *does*.
      Actually it does. see 'shift' there? It gets first parameter (object)
      and accesses _temperature field of it.

      sub as_celsius {
      return 5/9*(shift->{_temperature}-32);
      }

      > This means I cannot use my existing class methods work with the
      > remote access example. Does this make sense?
      Actually you may not only use existing methods, but also combine
      function calls with method calls (though it's not always a good idea,
      but if you have established function interface and want to wrap it
      into SOAP interface it could help):

      sub method_or_function {
      shift if UNIVERSAL::isa($_[0] => __PACKAGE__);
      ......
      }

      first line shifts parameter in case of CLASS/OBJECT method call and
      leave it there otherwise (function call). YOu may also distinguish
      between CLASS/OBJECT calls if you check ref($_[0]).
      Does it help?

      Best wishes, Paul.

      __________________________________________________
      Do You Yahoo!?
      Get email at your own domain with Yahoo! Mail.
      http://personal.mail.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.