in reply to XMLRPC Object Model?

If you receive different parameters in the different situations, you can certainly load different modules, or dispatch calls to different methods. However, it sounds to me like you used inheritance when you shouldn't have. Maybe instead of this RPC superclass, what you need is a class that implements the actual functionality in a way that's independent of location, and then some other classes that act as wrappers around it and translate as necessary for RPC, local, etc.

Replies are listed 'Best First'.
Re: Re: XMLRPC Object Model?
by jcupp (Acolyte) on Mar 30, 2002 at 07:35 UTC
    Doing a HAS-A probably would be better, or...

    I could provide two constructors in the base class, 1) that would return a blessed scalar (the apache session ID), and another for local use, determined by caller(), that returns a blessed hash... that sounds like fun!

    sub joe_method { my $self = ref ($_[0] eq 'SCALAR') ? getSessionHashRef(shift) : sh +ift; # getSessionHashRef exists in base class, or... # MyApacheSessionHelper->getSessionHashRef (shift) ... }
    Actually, calling by RPC, the 1st arg would be (for me) SOAP::Lite. So the above should be:

    sub joe_method { my $self = ref (shift eq 'SOAP::Lite') ? getSessionHashRef(shift) +: $_; ... }

    The blessed scaler (the sessionID) would be usefull for a proxy class -- wrapper for the RPC call -- client-side.