in reply to accessor abuse..?
Although the comment there says "accessors" those don't look anything like accessors. It looks like code to add members to an object rather than to retrieve or change the value of those members.
Is all of the code you pasted in the same module? If so, I'd say it isn't all that bad except for the fact that it is counterintuitive, inefficient and seems to come from a misunderstanding of encapsulation. This would probably be better:
push @{$self->{_fields}}, $field; $self->{_fields_hash}->{$field->fullname()} = $field;
If by "elsewhere" you mean somewhere not in the same module, then it's downright terrible.
-sauoq "My two cents aren't worth a dime.";
|
|---|