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

Re: [soaplite] dispatch_to

Expand Messages
  • Paul Kulchenko
    Hi, Robert! I agree, though I still think that in a long run we need to have this functionality (partly because it ll let you expose interfaces to objects you
    Message 1 of 3 , Mar 9, 2001
    • 0 Attachment
      Hi, Robert!

      I agree, though I still think that in a long run we need to have this
      functionality (partly because it'll let you expose interfaces to
      objects you cannot create, like COM).

      2Ray:
      As for implementation on server side you may consider assigning your
      object to static variable and it gives you choice between sending it
      on client side and keeping on server:

      package My;

      # class variable
      my $static = construct My ....; # expensive operations

      -- 1. if you want to pass it on client side

      sub new {
      my $class = shift;
      # serialize and send COPY on client side
      bless { static => $static } => ref($class) || $class;
      }

      sub do_something {
      my $self = shift;
      $self->{static}->{....}; # access it as object variable
      }

      -- 2. keep it on server side

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

      sub do_something {
      my $self = shift;
      $static->{....}; # access it as class variable
      }

      Be warned that second variant shares this variable between ALL
      objects of this class (it's class variable).

      Hope it gives you some ideas.

      IDEALLY in first case you should be sending REFERENCE to client and
      then dereference it back, but it's impossible right now, though I
      have on my list object-by-reference implementation that will let you
      specify type that you want to pass by reference and it could be on
      ANY level in serialized data and will be substituted by real
      reference on the way back. It's not done yet, and I don't know how
      valuable it could me, though it's seems to be much more flexible that
      available functionality. Any thoughts?

      Best wishes, Paul.

      --- Robert Barta <rho@...> wrote:
      > Ray Rizzuto wrote:
      > > Is it possible, using the Daemon process version of SoapLite, to
      > > dispatch_to a particular instance of a package? I.e. if the
      > package
      > > is called Demo, could I do something like:
      > >
      > > my $demo = new Demo;
      > >
      > > my $daemon = SOAP::Transport::HTTP::Daemon
      > > -> new (LocalAddr => 'saw', LocalPort => 1025)
      > > -> dispatch_to($demo)
      > > ;
      >
      > > The reason I want to do this is that the Demo object has some
      > > expensive operations to do during construction.
      >
      > Would it be possible to put these expensive operations into a BEGIN
      > block within 'Demo'? You could even create objects there in a pool,
      > so that the constructor call is quite cheap.
      >
      > I would prefer this over burdening SOAP::Lite with additional
      > semantics...
      > ..at the end of the road there the beast 'CORBA' and 'DCOM'.
      >
      > \rho
      >
      > ------------------------ 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! Auctions - Buy the things you want at great prices.
      http://auctions.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.