Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: SOAP Modules (OO or not?)

by jhourcle (Prior)
on Jun 30, 2007 at 19:51 UTC ( #624237=note: print w/replies, xml ) Need Help??


in reply to Re^2: SOAP Modules (OO or not?)
in thread SOAP Modules (OO or not?)

So, if someone wanted to call the same method twice on the same object, you've managed to completely remove that ability.

I guess you could do something like:

sub myfunction { my $self = get_object( shift ); ... # whatever's function specific, and not related to # creation of the object } sub get_object { my $self = shift; if ( !ref $self ) { return $self->new() } # a string? if ( UNIVERSAL::isa( $self, __PACKAGE__ ) { return $self } return __PACKAGE__->new(); } sub new { ... }

But, it doesn't seem like a very clean interface to me ... I mean, how can we tell what arguments should've been part of the object initialization, and what were arguments to the method call?

Personally, I'm a user of SOAP::Lite, but I have a feeling that its history, having been created when SOAP was basically just a thin wrapper around XML RPC, was a problem, as almost all of the examples you find are these sorts of calls. I don't know that there is a good 'best practice' in how to deal with passing objects using SOAP::Lite. (if there is, I'd love to know about it myself)

Replies are listed 'Best First'.
Re^4: SOAP Modules (OO or not?)
by Cagao (Monk) on Jul 01, 2007 at 13:39 UTC
    yes, you couldn't call that same method twice, but in this situation I wouldn't, the method is the entrance into doing all the processing.

    Think of the first method as being a new() sub which does the blessing then passes straight on to another method where the actual processing occurs.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://624237]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2021-10-17 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (72 votes). Check out past polls.

    Notices?