On Sat, 3 Nov 2001, Gerald Richter wrote:

> One argument for using $foo->story as get _and_ set method, instead of
> get_story and set_story, is that it is used this way by mod_perl (1.x &
> 2.x). Also I think one method for get/set is very common to Perl and
> get_/set_ comes out of C++ and Java.

Yeah, there's probably numerous examples of combined get/set accessors in
Perl.  mod_perl is a good one.  CGI is another ($cgi->param(...)).

I don't actually object to having separate methods.  My point was more
that a verb isn't always a good thing.  $cgi->get_param is really no
clearer than $cgi->param, _given_ that there is a known convention of not
prepending 'get_' to accessors.  I don't mind prepending 'set_' (or
whatever) for set methods because I think its a good idea to emphasize
that something in the object will change if you call that method.

Anyway, as I said previously, I don't feel extremely strongly about any of
these, but I think that these are subjects worth discussing before they
end up in the official P5EE style guide.


-dave

/*==================
www.urth.org
We await the New Sun
==================*/

Reply via email to