PERL15 Using Koha::Object[s]
PERL15(a) Code added to the Koha:: namespace should be object-oriented unless there is a very good reason to do otherwise. In that case the reason should be documented clearly.
PERL15(b) Code in Koha::Object[s] should normally not refer back to C4. Obviously, this cannot be enforced harshly until the refactoring has been completed.
PERL15(c) Use DBIC relations to (pre)fetch a related Koha object rather than searching it explicitly. (See bug 22407)
PERL28 Other object oriented code guidelines (in addition to PERL15)
I think we need to move the Accessor and idiom for -> new rules from PERL15 to another rule. I opened rule 28 for that depending on discussing the following:
Class::Accessor is a great way to provide access to member variables.
=> My suggestion would be to remove this rule. It is true but we do not say that it is the only way to do it. (We are not even using Class::Accessor in Koha objects.)
Or just say PERL28(a) To provide access to member variables, there are several ways including but not limited to using Class::Accessor.
A useful idiom for the ->new() routine in object-oriented classes that do not need to process the arguments passed in as a hashref but merely need to save them for future processing
=> This suggestion is fine. It says use a parameter hash for sub new. We normally do that. Reworded:
PERL 28(b) Use a hashref as second parameter in sub new when passing arguments.