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

390Re: [soaplite] Object variables on server, methods on client

Expand Messages
  • Paul Kulchenko
    May 21, 2001
      Hi, Nicolas!

      Store it as a class data on server side:

      package My;

      my %huge_hash = (
      a => 1,

      sub new {
      my $proto = shift;
      my $class = ref($proto) || $proto;
      bless {} => $class;

      sub access_hash {
      #... do something with %huge_hash

      And do NOT include reference to this hash in object (blessed ref).
      This example will work if you have the same hash for all objects.

      If you hash is different for different objects, but you don't want to
      transfer them anyway, then take a look into object-by-reference.
      Examples for server side is available in PersistentIterator.pm
      SessionIterator.pm, Chat.pm and others (almost all server examples
      have references to those modules). No changes required on client
      side, but this technique is more complex, require managing garbage
      collection and additional coding on server side. If you can I
      recommend to stay with the first option.

      Best wishes, Paul.

      --- kesslernicolas@... wrote:
      > Hi
      > I realize this question has probably more to do
      > with my Perl-OO-Ignorance than with SOAP::Lite,
      > but the context is a typical SOAP situation:
      > I have a class that provides numerous access
      > methods to a huge hash. Object instantiation
      > on the SOAP client will transfer all of the hash
      > to the client, which is not acceptable.
      > I would like to access the hash on the server
      > but call the object's methods from the client.
      > How do I have to build this solution? Please
      > explain slowly :-)
      > Regards,
      > Nicolas
      > 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! Auctions - buy the things you want at great prices
    • Show all 6 messages in this topic