in reply to Re: SOAP Modules (OO or not?)
in thread SOAP Modules (OO or not?)
Maybe I didn't explain too well, consider this plain module I use for handling SOAP requests...
I'm just thinking that I'll soon have lots of sub's in the one module, so it'd obviously make sense to move the bless'ing stuff into a seperate private sub.
In the future one sub may indeed call other local subs, so if nothing else, blessing it to the class would make my code nicer to read with $self->fun2(), and let me structure the object nicely, and pass the whole thing back to the calling SOAP client.
Thoughts?
Is that okay on it's own, or should I create a new() sub to do the bless'ing? I'm sure it's more a question of "best practice" than anything else.package SOAPServer; use strict; use warnings; sub myfunction { my $class = shift; my $self = {}; bless ($self, $class); my $one = shift; my $two = shift; $self->{one} = $one; $self->{two} = $two; return $self; } 1;
I'm just thinking that I'll soon have lots of sub's in the one module, so it'd obviously make sense to move the bless'ing stuff into a seperate private sub.
In the future one sub may indeed call other local subs, so if nothing else, blessing it to the class would make my code nicer to read with $self->fun2(), and let me structure the object nicely, and pass the whole thing back to the calling SOAP client.
Thoughts?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: SOAP Modules (OO or not?)
by jhourcle (Prior) on Jun 30, 2007 at 19:51 UTC | |
by Cagao (Monk) on Jul 01, 2007 at 13:39 UTC | |
Re^3: SOAP Modules (OO or not?)
by ForgotPasswordAgain (Priest) on Jun 30, 2007 at 17:00 UTC | |
by Cagao (Monk) on Jun 30, 2007 at 18:26 UTC |
In Section
Seekers of Perl Wisdom